对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 ]+ `/ a& a" ~7 |, P9 b' C . `" \+ C/ d) ~0 w- i5 t* r _ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 7 e) K. p" r3 e& _$ E
% c4 X) l( e# l; _- g; f F 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 8 e$ G( M9 R8 u" g, o7 S* x
4 h/ t+ J9 A8 |8 E
Options: 6 n1 R5 g. r' m
* n& e+ s. |0 R1 l3 v2 u6 S' g- a
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 2 b' Y4 a2 ]; m! x6 j( `" t _ 4 B k+ ~' K; d, |* M1 E
不停的ping地方主机,直到你按下Control-C。 6 m, \, G2 G& _" P7 Z R
. S7 O0 Y u8 ~/ Z 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * c; _ a8 w( l |( S
* ~4 D @- C& W$ w/ v -a Resolve addresses to hostnames. . D8 X+ O3 D4 x9 p - R5 H0 [. C( a0 a0 K7 O! W. I 解析计算机NetBios名。 b/ C& \1 a3 t3 b, M; o ( C/ Y* [; U& C; r
示例:C:\>ping -a 192.168.1.21 . ~; t. P, J: i0 F5 ?
4 y1 Y4 Z# l# y6 X Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 0 H0 a4 i7 _2 q. O4 N
0 l+ X$ p; s/ w6 U0 _
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / k: T2 m( `# c" Q% b $ R4 E7 f8 ?/ c( O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( }! c! |. z- O7 p/ O$ i( o0 I2 R
: j% _. {, H* b/ J) C" `% E1 S/ V9 P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & N( u, e2 s! \7 `- ]1 Y3 J, |+ F. G7 y4 Z0 s2 {7 R/ q
8 E. W' o8 U8 }) Y6 o* x) h. v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , s( s! I$ d! B2 n: @) H# H9 X" R3 ?8 Q ! X) |$ V7 M X2 ^- f, P
Ping statistics for 192.168.1.21: 2 a" Y. H) E; X* \" p4 h% }
6 a# t; N" ]. N, Z. O Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , b2 l) d3 e; z/ M! l- n [1 ` " J! O0 O' `: i }+ {7 C' |8 R! X Minimum = 0ms, Maximum = 0ms, Average = 0ms $ f- n6 e. T6 t$ p' } v 9 V4 l( P) m6 E& D9 p 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ } J7 m: ^& A4 c! P ^ . J2 M2 I) I# [5 f9 R: p0 d* u -n count Number of echo requests to send. $ \/ |( { E, l! I$ h ) X3 [3 _6 X M! p4 m2 D6 c
发送count指定的Echo数据包数。 % N, S: T2 D" H9 L! z6 ~
0 {3 _6 r1 ^; W0 V: q: L 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' G% ? G, P4 |+ q% ^ # a7 y3 e" o1 j/ ]$ a$ w+ U C:\>ping -n 50 202.103.96.68 . @" t* q( ~1 R3 g K1 \, E, }
$ O% H8 W# K7 ~* R q! \& E& G
Pinging 202.103.96.68 with 32 bytes of data: ; l( H( M1 i4 i e* x0 ~8 f( \+ o 5 _( q$ K8 \1 B Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + S1 T) N3 W2 K# h' N . i2 y& f/ C1 q" Y& F9 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( T8 Z0 m7 ], o
# a' L& V; u5 D7 _5 R( J8 V5 K- z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! P) ~' ^: O2 {2 t
, P8 c& b8 A% R7 H. \
Request timed out. b( e" R* Q9 o# ~ 5 J6 m4 \' l% l. H
……………… ) ]+ V! i3 N9 Q
: P# }- _0 P* O' \ O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 l) }& R) T+ }8 {! h; N3 V4 y3 C1 z ) C- h% S) W: X9 k6 w9 O3 O v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - ~: u( g2 o; A$ v1 M9 Q9 Z) ^
. A1 `4 ]; }+ C8 Q
Ping statistics for 202.103.96.68: 8 A1 i8 t+ [! d7 k # q, y$ }4 d; U; N+ m
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: q& _% \' C- }+ x8 x + P9 S1 s2 Y& z2 r. ^
Minimum = 40ms, Maximum = 51ms, Average = 46ms R& G' y" B4 x5 V8 b . [( q" v2 |+ g) |- v9 y: [ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 % H, O. `4 d7 T+ t; h0 X n* i # V% a- u/ B* m" m2 C* d% _; j -l size Send buffer size. , Z. o2 Q, @# X- H5 P. Z 5 z9 N) H4 R$ {7 P+ @1 B( t
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54