|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
) s8 _9 ]7 p y+ H& A0 _
7 C5 H1 Z8 K; O! _8 h3 l 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. \( V4 d2 N$ b: q( p! g" P Q8 j 4 v; X5 ~) S$ n4 [. p; u
ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [[-j computer-list] [-k computer-list]] [-w timeout] destination-list % F* U, J% h: u% a( [
7 ~ J% P/ G! |; \ Options:
7 Z( w' F& b6 Z0 S8 W0 ^1 Z4 @
6 ]: x2 i( ]; B -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - i' O9 C" B6 b7 y& B
* H8 V) X. }+ L7 n: Z9 h0 I0 w
不停的ping地方主机,直到你按下Control-C。
+ L% D% c% S! a8 {8 c ! J6 G) X& b- O2 t1 N
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
! G( x0 m1 Y2 X5 t( ~9 j) |% o
* m3 G3 g& e$ T5 R6 C D -a Resolve addresses to hostnames. ) f5 u! }8 r0 E/ W, x* ?: v
6 ?* T3 P0 q9 ~- y A, W
解析计算机NetBios名。 5 R1 a) t% H: m1 t7 f, }
i" M! F, x7 d 示例:C:\>ping -a 192.168.1.21
$ N9 {- Y/ S4 a5 |2 `, i
) K! I; d' m0 B. Q1 Z Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
, Z: ?5 A1 C" H, [ |" d " C* |3 @; L, n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 b7 A, p5 y! H4 Y# g
5 |0 H( B7 B- \6 b2 \4 ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 x' ~4 G) z& U; t% c
+ X/ G) w7 U j. K* X" `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 t+ G! v5 t7 j$ F: m
- ~- H! f' {# c g' ?9 k) M
! W, Q1 i$ I5 \ T Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 N' |# N) P; I# B2 z e& q4 }
( W" {2 A+ G( J3 ~ Ping statistics for 192.168.1.21:
) T+ [ w$ @' {6 b# T4 B3 j' }
6 Z( e E% g) T Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 3 b, p( D( n1 Y4 k0 G
+ ^4 M# k& o( @1 |
Minimum = 0ms, Maximum = 0ms, Average = 0ms
# ]9 H% Z* v0 i2 c* l7 G
& `; d9 R# R& S- Q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . c$ i; r8 H% m P& J1 |
- V" P2 w" F1 \' p1 V
-n count Number of echo requests to send.
* X: O# s1 F$ r F$ k V$ q+ w/ @
0 W8 V! H# @+ O 发送count指定的Echo数据包数。 # f7 K# h; }# b) {* {2 }
: j# H6 b0 x7 w" y
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 P" K0 L0 E5 j h) A ! Z5 C1 U6 X E( a9 O6 _% m
C:\>ping -n 50 202.103.96.68 4 g9 \' y* u. z7 m& ~
4 u" P6 `4 @# e# _ Pinging 202.103.96.68 with 32 bytes of data: ; { ^" Z( e) V) ^# R
" K0 \" Y* M- W" k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; m: B2 w, o& h# {
1 r8 I( `+ y% t/ E6 P+ u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 j" G3 y$ X2 q L
* s+ n0 R; s5 }- }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # l/ ~0 j! o: r* |( }8 p
3 B2 [9 T B1 P! g$ M3 s
Request timed out.
7 C# a, J5 \5 |( c9 q0 w% `8 }
" b ~- s2 r" H) P ………………
$ Z, E0 Z+ @8 M) W/ _% { / d4 K' l5 C6 x4 F/ `( n' `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% Q A0 D% b0 }! a$ x 0 T7 k2 X8 R* M, x' J9 l% C9 u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 V4 w S9 z Z# g
7 Y4 b7 D Q- O& T0 z$ v0 C Ping statistics for 202.103.96.68:
3 y$ O9 `5 g/ v9 T. M3 Y) q ) ^( h6 A ?- q: q2 P7 i/ Z) [
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , @5 N5 ]0 m" W% I0 Z
% i& q+ r3 |) f' M9 i Minimum = 40ms, Maximum = 51ms, Average = 46ms
+ {4 T' B k* X/ H ! l' H6 c6 w ~3 S2 ^$ Q. m6 A
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 C& i' C; f, {" M& g
) v4 T/ f% l Z6 }9 L/ N -l size Send buffer size. # u4 Z" k' L8 D; C; h& W
( j, _7 O- E8 \7 x1 h 定义echo数据包大小。 |
|