对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 \; D2 L w. ^1 s+ Z6 ?9 Q , \- {8 [* ~- S( y, ]
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ; b9 R0 ~$ a' y# g 9 z4 X0 B" B( {& s9 c4 ~ 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 3 I9 _( E& B) v2 O) d1 Q _2 l3 i8 T/ v4 v, D# O! p
Options: * n6 r; I7 [# {$ z y: ~! q4 \9 c% B1 ^- S/ W
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. . ~1 ?& S2 {4 @' N
- o! t# J1 p: g6 X) K$ p
不停的ping地方主机,直到你按下Control-C。 H" q- E, C- Q, I& p0 F% {
* X H0 D8 Y3 v% {' z 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . ~4 M( n) v1 P2 W : S9 N+ r3 D' G# D1 | -a Resolve addresses to hostnames. 3 e5 x1 A" w$ J9 D: [! j
b7 @# p; d$ A M7 c. Z
解析计算机NetBios名。 1 I6 ]( t6 ]5 o! t, B% n+ y% X/ s' Z & o$ @$ a( Y7 K, X$ [$ j3 b
示例:C:\>ping -a 192.168.1.21 7 Y; ~1 H& }6 p1 r
9 h+ I4 N* I' J# M
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 1 {: d& F t6 T5 L' H# x; s & D( K6 Z# K: g- L3 ?3 S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 D1 G7 m' S$ G
4 w! t$ U5 r' M. t% B% m' O7 ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( ~$ V, v0 X5 e 4 E0 O& Y( P7 X1 b" R0 t Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 k& x+ v& n% m E6 D( V7 I! a
$ r& i7 o1 y, G' Y* G0 K6 }4 G - a- p8 [% J: Q" l* P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : g6 \& e1 ^- F6 c% x
' P8 e" Y7 ?* z& l6 L
Ping statistics for 192.168.1.21: - N$ W. x2 M1 E0 W4 @- f
5 r; L& M3 R; Y% a) b, Q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # I6 e ^9 g4 Q! d. } ; r9 {" k; U b6 F Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 t) @/ N4 n3 G& w, Q8 }: _& G
' d3 [) P( A9 }7 ?
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ! E/ R% B# L+ D/ ^( K) I, s
9 v8 i/ o3 M, B) k3 n
-n count Number of echo requests to send. + M! Z7 j7 d |8 t. m) a: Z" e. b, u
5 K, x8 X9 H$ D6 l) U9 G
发送count指定的Echo数据包数。 / I* {' U" ?$ m8 V; \5 k # n6 E' u* M' t& \" k4 j7 h# i+ J
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: / X$ d+ g' a0 D9 M c" v9 ?: O
% M2 \' c% a) a C:\>ping -n 50 202.103.96.68 ( |7 d* ~4 O* H: F2 @: ~1 I ! w4 i& c2 |$ K$ N# k. o* | Pinging 202.103.96.68 with 32 bytes of data: 7 W1 D# g% x8 }2 ` . Y- p6 w) b) D* w1 a, H) L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 [$ \2 P- v+ ?
5 q/ z& _7 g4 X: g9 \5 i Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : j: g. c' ]; v; u/ R 6 r; Y0 J4 x& W: ^; q- G: s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , X- X( x5 A/ q0 I Z4 r7 J9 l+ ]
, C4 Y0 N. U5 H; H- G$ _" X
Request timed out. ; c" r4 p7 l, L: ^. T/ @# p& j/ g8 J * e( s U! c) l# s) ]4 _
……………… 2 Y9 t8 d- M3 W- T0 K/ `6 h2 u : r( |" L# G; C' D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 }3 E# l" Y' w0 ^! V - W8 B8 |% F7 a& U2 \% T8 z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 T8 L( K$ t. k
8 x6 z. @* V; z. i6 H! V/ M! l Ping statistics for 202.103.96.68: # y. y9 ?! W' c8 O' y
0 N4 h0 }% }7 |% o" w6 n( U Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 @4 e8 G P. X, u$ q4 v
5 _" V! A1 ` i! G Minimum = 40ms, Maximum = 51ms, Average = 46ms 9 A9 ]4 u0 s# _1 k% f6 ?) k
o/ K2 ?9 j. D& f
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 3 S5 A# u7 B0 p' C- ~+ E6 o* { ) ^6 d ^/ E9 Z `0 J z2 A$ u; l
-l size Send buffer size. 4 P& \2 Z$ G* g: A2 y 2 V# T+ p# r, v3 n
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54