对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ; I# j! h& v; Z. I% D
0 \. @1 Z4 @% u7 j K5 Q
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * p! M a. S+ `! F% @& p 2 M* D: j7 l* J" X2 I2 g6 a
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 % _2 h3 ?0 V# ^$ W" j+ t
- u0 t* h: j W x' }% W
Options: ' t- T4 H' t0 }2 l. u' T ( _ C( k5 i& _- g( _" ` -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. / c7 i3 d. R! F1 u( P* Q' O
- f% h2 j8 q H6 e
不停的ping地方主机,直到你按下Control-C。 4 I; g; \" J, m& M
+ Y$ F$ X7 g( S
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 1 u% B* d4 ], P+ X# }
% U' e9 m z+ c6 l- z6 o* @4 P
-a Resolve addresses to hostnames. 4 e* o5 Y4 k( q# B+ }; Q
4 r* ]' K5 ~) t& S% ? 解析计算机NetBios名。 " [$ }/ X9 o7 X$ J" z% [! d8 ^
0 @0 S P) E9 e
示例:C:\>ping -a 192.168.1.21 & f9 o1 r! ^4 b p0 V, W9 T
. O9 _9 C! h" }9 \3 d) A Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: " c. p% O; f* ^- ^, U
: M" L9 U% q% o2 } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ W8 q# |& ~3 f; J) J E+ h' P / r2 @4 w/ F2 g& K( |6 f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 E! e6 N+ [, y; V
( z! e! r5 [# |+ W3 F Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # y+ W6 a1 H+ h* q" r* g
3 ]* Y# U8 G, T 0 O L. L- h# B% \ J0 P, c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; v# q% w K( y6 n
; q8 [( ~) p! y8 @8 n
Ping statistics for 192.168.1.21: - ~+ b: [5 P. H" Q; {/ h. L. e& S
7 {! C. b/ Z; T2 W% [
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: " W6 @: b( x4 [( ]: V+ l & G; B5 O2 ^; k Minimum = 0ms, Maximum = 0ms, Average = 0ms + e. k( ^0 Z) O* i0 }! F
1 Y& J# x4 l) N" h: C
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 R& h+ T8 f% \- ]- y6 w0 P0 ^ 2 s2 w# \% _2 ?& a- `7 }& [& d -n count Number of echo requests to send. : x. L( U+ w% o& |9 T 2 k5 W) o8 j( O7 [# D0 ^
发送count指定的Echo数据包数。 ' n M! }; J; R' S7 O+ X! s
\ ?% n1 N% Y- d( j 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: . `/ Y* p9 v1 _8 f- X $ N$ p/ R/ a. L* H" h$ s; a, h$ ]2 x7 i
C:\>ping -n 50 202.103.96.68 # O& N/ O/ j. i* p8 B# B . `: _+ J4 _0 A' j4 l9 U Pinging 202.103.96.68 with 32 bytes of data: `7 h! \0 T4 ^% K { D % G4 X9 [* q1 [( ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 A# B8 ^/ C$ L8 b" \ 4 @2 E0 x1 a: `' Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . w/ |7 e- @! m. t * r. r( r, T( F; p# t, T% o, \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 @. ?" @0 j2 l, J
" X" a. C) f: U& U6 T. `
Request timed out. 3 F1 v E/ \6 e! R2 D
0 N& K ?' v7 k0 [+ @9 u4 { ……………… - u! X1 g. ~! b0 r; h
( S. G$ b3 F! p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ L% ?( B0 |2 J" f # n" e, h3 j) b% J7 Q0 f( s P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + L0 |' I( W/ S& H* D8 u: E / Y/ {7 y# z. q, j Ping statistics for 202.103.96.68: $ @% m% L/ y4 n( h0 W; U6 |* N0 I
- x+ A% L7 Y- S# a' P4 ` Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: l" X7 D( b) u8 p9 q2 D# E( J W
8 _4 j. Y+ z% m4 j8 o Minimum = 40ms, Maximum = 51ms, Average = 46ms ; w$ D! q8 g- ~* s
- [3 g8 j- J6 q& t! ?1 @
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 `6 ]+ ^$ c& i! W% \ ; Y2 }& ?' H- Z$ w0 x. l -l size Send buffer size. - `0 X2 ^9 P& n j1 A, c: S9 e+ l
4 \6 d' R/ J: ^6 Y0 ^- S6 f 定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54