|   
 UID3 帖子66 精华1 积分2387 金币1067  威望1015  贡献1000  
 | 
 教你正确使用Windows的Ping命令
| 对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 E5 e2 I* K/ x; i7 B# A + q! i8 K! |- x4 }1 M& L4 l
 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
 2 K3 {, z) ?! n5 |  G# y& T   7 i$ j, c0 \' R3 ?
 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
 " K. |# ~% H) e8 w1 a     C! v* R  a+ @9 Z- [
 Options: 7 t& U+ F4 w- x' `
 
 $ ^6 k. }) l& q+ y; X  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , f# J1 f  x" M2 F# o
 + |: ?! A( e/ U7 Q6 s
 不停的ping地方主机,直到你按下Control-C。
 2 y5 F; d( e' B/ {2 G4 `6 x   " Y: G9 q+ d. z/ ?/ {$ L
 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 % c( \/ {3 b9 I- m5 H
 / t# m9 V1 n  P0 l
 -a Resolve addresses to hostnames. : `( G/ o# _, J' o- z
 % e" W8 S6 U8 l( E! P
 解析计算机NetBios名。
 % `! o3 v1 o0 H8 t& S5 H   # G* Z& |9 D3 R! D
 示例:C:\>ping -a 192.168.1.21
 . G: C$ g3 p  R8 U, ?: J   9 e2 p3 f$ _0 B! Q
 Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
 ' b6 c3 Y% ^! F) Z
 : W9 ~. U+ k8 |; s) A& a+ }  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) t) ^* o8 y) [1 s
 
 ! G! v, I- {/ \8 d) g1 \6 i  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % v1 D* G) b6 k
 1 R, s, I& a1 X
 Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . u  Y+ Q* Z7 v- ~
 . k" P& p& T3 ~0 w: X
 
 # d7 \  u7 E( H; L- {  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
 * Y, L# ]: b  ^   ( d. W' f* y7 _0 a/ X$ N
 Ping statistics for 192.168.1.21: * g  d: m% g7 k+ H. r% I1 b
 
 , n# j0 M: @, X. h8 z) C  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 9 g2 e& d/ C% ]( |% S) E2 d
 
 3 W3 G* L1 u+ ?2 A5 m  Minimum = 0ms, Maximum = 0ms, Average = 0ms
 8 e6 P) y) q/ ?
 , {6 O7 o$ z' p: h/ _' M  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 3 ^, `2 c8 [6 ~( K$ U; a$ D9 n
 
 0 I! O2 S) o; u1 o0 P  -n count Number of echo requests to send. 6 {0 h6 ^! y# l  q6 B. F/ ~
 6 f( v' X) _* q" u0 k/ [) S% l
 发送count指定的Echo数据包数。 * `4 p' W2 D+ ?) K4 s( a% ?; z3 s$ f
 
 , G' k$ w1 A5 x2 `, `; L  m6 A  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
 6 [" @1 `, ?  B
 . Y; K) I, y) I  C:\>ping -n 50 202.103.96.68
 ! ~- g2 T( A9 B; V( @, Y- @# t   , T0 h3 w" e/ D! Q
 Pinging 202.103.96.68 with 32 bytes of data:
 / j9 e/ L! i. e4 b+ t8 ]
 ! Q; p6 @7 S) \3 `6 L  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
 - Q5 C2 O: f$ e* V5 B! m% v, ^5 j9 E   1 \. r7 H0 u3 K, k
 Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
 7 b) e% a$ [8 B
 ' }" h/ L) B1 a  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 u% M6 H; Q/ ?) u
 & v- G; F% C3 {. o
 Request timed out.
 : O1 _* W4 P9 \
 & L. w. e$ l- T. v8 k: o5 Q  ………………
 . y2 `$ H) X* B9 [8 l
 ; g" n; A$ @( g5 T7 d' I  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 b4 ], `( |" p* K! v
 9 g3 f% N0 _8 u/ ]
 Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 {1 {4 ~4 M7 a. M' C
 ) N  L! F0 J+ f5 o  X3 k2 }
 Ping statistics for 202.103.96.68: 0 L( V$ `1 J* Y' |
 
 4 ]& b/ x/ w8 h$ j  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
 & ^2 I4 l' [  D   ) W5 p9 N  w0 f3 A
 Minimum = 40ms, Maximum = 51ms, Average = 46ms   R* l9 D" [7 J
 
 4 _) e5 B# Z2 k% v3 u: J! y& Q9 ^  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
 . X% K- r4 I; l6 t9 ^  C. ~: \- b   $ x9 V4 i0 f# f1 R) s$ s/ \
 -l size Send buffer size.
 B  W( N+ W( Q+ h
 6 m7 x. I) D& c; n$ F/ p( x  定义echo数据包大小。
 | 
 |