对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ( [" J2 T8 _0 U7 g+ t F1 w5 ^
* Z" F4 \% j9 \# G
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 8 f1 l3 ~$ b% p+ D" {) M
3 p( K2 ~: D' l v+ p5 G* y
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 # L4 m& k$ f) K0 M4 a$ f6 M2 D
1 O* L" o3 |2 U4 q& [ Options: 3 C5 l. j. @8 R- |! s $ O' d% p- S L L% Y1 R -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. $ s0 ~! D! m$ I( t Y) n Z' V1 ]+ D8 f/ N' [6 e
不停的ping地方主机,直到你按下Control-C。 : |! M5 X) ]( j# P* v& B+ n
* i+ X6 N; a. H" ~7 M( i* T* k 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 `! |$ O2 _7 c( q0 t ; x J3 G+ @( Z% Y -a Resolve addresses to hostnames. - T* u6 E x5 F4 }. i
: _+ X# @% C" X7 @ 解析计算机NetBios名。 . ~2 G( r. X. g+ V& z ! |; f) k8 c4 ?* D
示例:C:\>ping -a 192.168.1.21 0 U2 C$ c) Q+ ]; W 6 u( `* Y% c; U/ ?+ b2 j9 r F
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 4 t O9 X% J' l; Y2 R. Z % D) B; m/ s/ @6 m/ w. ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 [4 E8 ]4 F( L. r; W* e6 ` 4 v' ^" Q& {! P8 r/ J5 o2 ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 g( L$ O+ ]$ b% s0 U H" `/ s0 [( ~
# o& o& O+ F# d+ j0 }9 _+ t( y " A/ u# j4 y2 ]" W' T4 V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * Q/ T" x, e6 ^; L! T+ r* M% A
( ~+ _3 J% }( P. F4 d7 y- h Ping statistics for 192.168.1.21: * n9 A# X- c S3 f4 N& c
# i+ U- [7 n0 Q! s J
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 6 [. D: L6 C, [% [0 x; u
# V! }* m1 _& m; l, R/ ~5 X Minimum = 0ms, Maximum = 0ms, Average = 0ms " d. z1 Q8 ^" a6 h5 @8 f* r8 E! G 9 H) I( B" b4 F8 |; `% a) H+ X7 h
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 4 P( B9 {' v& `6 N 4 _9 Q! V) t5 f. P -n count Number of echo requests to send. ! j0 h9 E! A/ K$ H \0 B
3 L k: p- T) \: u 发送count指定的Echo数据包数。 0 P( Y* h0 |( `! G# L 8 C# u4 s( f5 f 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( y* n9 P! q( b: J; x" z: K
$ v7 d* T( K- N2 |8 v
C:\>ping -n 50 202.103.96.68 2 N7 M: K7 i6 }5 k
8 R& B' z) q9 m Pinging 202.103.96.68 with 32 bytes of data: ; K2 V3 W+ E9 A9 ?& Y4 e; Y: u+ w 2 q7 J. b1 l" w0 a5 P" r# ^) q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . Q& J2 a2 [* b5 \- X2 z" L . T% h/ H' g' x0 d/ W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( m! I5 i' y3 x. g; ]6 ~
& N1 s/ z2 x) J3 R6 B/ m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - {/ I: J, W2 D2 p5 _9 P! J. L( m # s5 R2 Q' k% r Request timed out. + `4 m u0 b7 U# X9 n3 H2 h- F9 d& ^
! I4 o0 }; D6 n- C* m ……………… k/ w& [; Z# O" w* D* A f, M0 \- s8 g! T' A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , h2 j+ y" Q# y) P # N& E" {/ e I- y e) d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 |9 x' D% k: S- x " N6 T, D: T' N% y, ~1 V
Ping statistics for 202.103.96.68: / d1 F8 I% |% p& V8 r# D# s $ ~! q8 x3 L5 Q2 s
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: + A' D1 G- o2 T& A6 H7 I- m9 ] : j. Q0 A- d1 N5 L3 K3 ?. d( K7 D& Q) ]
Minimum = 40ms, Maximum = 51ms, Average = 46ms 2 T3 m) f( i' n 3 S2 {# c# ^. k& d/ c9 z4 J7 B
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : |0 v6 [4 s2 m v
0 g4 k) {; I) ^0 C
-l size Send buffer size. R6 x4 ?* n' \# X ) p6 G. |, o0 H
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54