对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 2 s& T& Q8 M8 C. C9 O
/ p8 N* ?+ q+ |; p 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 l4 k: `( ]( ?$ U ' O+ n" e( ^) x+ t @ 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 j3 r; `' J( e) s4 r4 U: Q + o) U7 G% V5 D$ `* y) D1 d6 y
Options: , i+ S: `( D* D2 d* Y : Q7 _& N n; k1 `1 m4 G. r/ [* C -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 N6 ~$ x9 N. l5 C4 D $ z" D0 Z& R% A/ r3 t2 u! d( Z# `: Y
不停的ping地方主机,直到你按下Control-C。 4 w8 }, |8 Q! i2 U" R8 _ # w6 F" W7 ?! t. z
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 M- i6 F9 l/ D! B1 {# _% K ) \8 y$ C0 d, ]$ n% C. F0 H S
-a Resolve addresses to hostnames. ) v9 y( T" M; a/ i7 }8 |7 h 9 @/ |/ w w! t4 h" W$ o 解析计算机NetBios名。 5 [4 w, q0 r; R' M; U
: J0 z5 j- J) l8 t% M) ~ j
示例:C:\>ping -a 192.168.1.21 & P/ N* h0 g$ J
+ `2 a6 W& @) w; v% V" o Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * z: y6 M g- P6 N! R4 k2 E ; P B# ]8 s& _+ V% J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 t) k0 Q8 G" c$ R( t5 R3 U 1 W# Y! R; t, F. d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 n3 x; e8 ^5 T+ E& X. i 6 k& f! E9 g" e% ?0 r Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 k9 ~6 K2 r8 G) V9 R2 }8 b' y( L. z4 N; @$ b
& z* L( x. [3 i+ C 7 n0 r2 M7 z/ u( M5 h; H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 Y. I" [. }/ I. i/ l+ a& \ ! q+ G, E, {, R' N1 J Ping statistics for 192.168.1.21: ; ?$ F8 u; h9 f0 }
2 i9 T, B$ C2 R+ f
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: $ |) Q( v5 K- _- n
* r2 ~: t' f u5 [# s; W7 U Minimum = 0ms, Maximum = 0ms, Average = 0ms & B9 E7 j/ ?' Q3 F# d
3 w. P8 `+ M% d$ |& G
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 u& V/ s3 Q9 {7 s4 i+ P6 a( _* ]2 s 4 {# v, T: f5 q6 M: |0 I# m -n count Number of echo requests to send. 4 N. P( i6 R' D4 y( G( |3 i
- A. J2 Q8 W* s [) C, n' B9 C R
发送count指定的Echo数据包数。 3 ^0 L, x- O, s3 ^7 y" V 6 ]' F2 Z0 s/ G: b 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! N8 z; k4 F2 H9 U! ~ 7 p3 J% m2 x3 w. V q0 E7 V R C:\>ping -n 50 202.103.96.68 % @" Y. V. R# S1 s* U
& I/ A' S* q5 S/ r Pinging 202.103.96.68 with 32 bytes of data: + h1 l* H7 W: l3 Y8 n6 q& S
0 ]. H$ [- r3 A7 l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 W a0 s. G2 r; O) t - R7 Q6 _7 U6 u4 m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; d9 G5 I0 l. M( k! G$ z
, a6 p T7 t y7 C; J0 W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & L$ H, K& i! O; c . C) |( B, ~0 j0 D- a Request timed out. 2 j* b8 `' \( A8 ?
3 u$ |6 o a c7 ^) D m3 ]8 W
……………… + E1 c3 {1 q+ F) _ & ]/ V: y V5 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - R9 X2 i- M% i1 }5 D ' Z: y2 q. f' ]; E
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 ^$ I. {4 Q4 Q6 q / T' e8 I: c2 t1 p
Ping statistics for 202.103.96.68: : I+ V* L: u4 [" ?: R
$ V" @ Y4 ?! f) z0 z+ s+ Q# g% N# L
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , R+ R7 w( I! X" r9 [ / n* O; Q; W; \* H: Q6 R X
Minimum = 40ms, Maximum = 51ms, Average = 46ms & w- c4 p7 M, N' b2 S5 J# u2 {0 w S
- E r) A/ M/ j- E
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + A1 d9 F( S9 K$ b5 z$ }% a
8 ~+ R. N |4 X1 z K -l size Send buffer size. : V$ _5 h# X B9 v2 }; r8 t 7 V/ ^/ _2 j% S I 定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54