对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + `& ]1 e+ u8 m$ ^5 R$ H
0 s, t. s/ M6 t& {( O& Y# M" z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: / E) Z U% n' A
4 Q9 f. p$ X/ N0 U! p q2 B+ u
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 / n3 m2 ]7 R0 x* X# h* q- S , H, V3 J& T! {( p7 I; G" M Options: 0 G5 }/ }4 z; m7 L, V) }
$ i5 A9 z. ^! A6 y2 B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. . J1 w) D: G$ g# f
! p0 a7 t8 s* H2 \1 p; V2 N 不停的ping地方主机,直到你按下Control-C。 4 z g! X b9 `, V % f) U- x8 T% L6 q5 f7 c% W
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 1 G: k/ H+ l- b
8 R, k/ ~2 w6 x+ t" }; P
-a Resolve addresses to hostnames. 9 _- u9 C$ _8 T0 u 9 z4 _8 H B9 L8 s 解析计算机NetBios名。 ' e- u! _) e+ n4 ?/ |% u 5 T! N( h/ y! o% {/ J& g5 H 示例:C:\>ping -a 192.168.1.21 v+ y9 a& o8 K1 W, |
5 H. R: `1 o8 d, X) H/ F
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; D7 ^& v; A; d% I
) H8 Z$ {- w- i2 U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , f- B+ T6 o- w. V3 m9 C- t& V# j
( j+ {" n# ~* y9 M1 o3 u6 b; c0 ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 g; ]+ y; H) Q& d0 f7 B . g, o7 V8 k8 F! q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 x3 V4 ^/ P+ J( |( c4 f7 A& G$ ^ }
2 N& C. o, X- f2 H' m9 o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * F+ P4 \; z( j0 n
2 ?) [: \' j: Z% J) h' Z
Ping statistics for 192.168.1.21: % @: h$ Y: S8 F% b
0 c) @& p" T6 j& x O) K Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # T {/ G7 ]/ l- f5 j ) N3 I/ M# t8 \% o e) r A
Minimum = 0ms, Maximum = 0ms, Average = 0ms " }5 m7 R: v3 ?- `6 Q4 [ 5 B @2 [3 j. f8 H; g5 n 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + v) p: W( a9 f- u/ n
! n. I( C; L: a' Q. t" z- `. K z
-n count Number of echo requests to send. 3 h: V: w; {0 G( f ; Z7 J: M. {/ @4 F/ B/ q$ ?/ `
发送count指定的Echo数据包数。 ! T b- S! T6 A& Z0 B
; A5 Q m9 [0 A" H9 x2 l; J4 i* K! Q 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: / g2 p# r! q; M
9 c E3 Z: e0 J* A1 h3 k2 C
C:\>ping -n 50 202.103.96.68 # w. f* ], c+ A& D: O1 u: { % ]- R7 G# l2 J/ d$ [/ v, K. h Pinging 202.103.96.68 with 32 bytes of data: ; |; s/ [+ N9 E7 n7 Z% @ , A0 T5 ]/ v& l" B8 o8 u" S8 l4 ]" ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % m7 ?( `& i, b3 p5 `# ] - W7 e3 B4 k6 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 B. K3 i; R o
, I) l. q( {- G( X2 F7 U/ c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 U; U" Z7 u& \9 [( ?% V% ?6 @ ' s) t% w2 {6 k- c" Z' V
Request timed out. 2 y; u/ \, m$ a! c2 w+ J0 g
% n1 p1 p" l$ g$ J7 x ……………… ( T9 H" V) | |/ T
# ]4 v j% o3 }8 p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - j3 b/ l: }: K1 E8 O" n+ A + n. ^$ j6 h8 Y5 m# F6 z. r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 m' p) x( P0 h9 E1 m# N) @9 i4 m# U ; l$ g* u2 v2 k2 G) [1 C: w
Ping statistics for 202.103.96.68: 2 j. H1 r% e" d; _ ) d, V) q7 p3 [1 G+ r: [9 \7 n6 l
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: * u- j, f8 k* k9 n. H
/ F2 M" {4 F" Z* ~
Minimum = 40ms, Maximum = 51ms, Average = 46ms 3 X4 v+ \% V& w' n( @ : K/ Z4 ~$ Z* i+ r 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : F/ T P2 q2 v7 S# [1 F . n9 b, P1 L7 Z7 F s2 `
-l size Send buffer size. G5 @0 k! V$ g, h # R3 `6 @; o3 { 定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54