对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 : q( G: |2 b- o, z% n1 |; S * l! \6 u' D+ u" T2 B ~ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ) U* [' p# D4 w3 Q: f% m/ P& K8 K
0 m* s& n7 ?0 u- U, S7 t" Z% ~
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 + r' A% P9 I( Z8 J: a8 n4 `% ? z% }. {1 F( d' f
Options: 7 {! S2 z/ h, j. b! ]8 J+ x * h5 {4 U8 M- |* k j2 b -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # r7 a# E. a9 y3 y* a) x( g( K 6 l* {1 w/ I: Q. R* J2 K2 R. s 不停的ping地方主机,直到你按下Control-C。 . a! D6 J- P- n. d' J3 f
5 X% S: x% l6 C' S9 ] 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * q! `/ \" U5 p2 ^! \! R5 H & n/ w" M0 f5 B$ [/ U+ ^ -a Resolve addresses to hostnames. , N, p& u F, d/ m3 f. P 4 ]0 M3 i! Y+ v9 R {7 I" p 解析计算机NetBios名。 0 a6 B4 G# O& j1 T
8 N/ W p; V( w
示例:C:\>ping -a 192.168.1.21 * R" A+ P, }2 i: X8 R( w1 H- V , u, A2 P7 q6 n' U% G Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( |8 {( p1 L: S0 r) ^ 4 ^$ G' M7 z B4 m/ U2 _6 d Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 Z$ G8 e. ?' y# T . d: x) ?9 W1 G6 X6 s) ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , M2 K# G q5 K" L! d$ ^/ }( c
6 j4 h- d# v8 V. u9 f; u% I
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) N' E+ H( F2 a/ q0 p4 x# J( e. Y
; v5 f/ z7 v9 p" L
! j4 l( c: M( n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' L' M& k& o0 Q) }+ E' R9 H H : `# T+ q G+ C3 B1 E7 X1 m
Ping statistics for 192.168.1.21: / i' k9 L" x0 o1 {$ z* G4 A
7 o; r- ?/ u0 ^* {' l" y, s4 K Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % [, J: Z M- N2 U5 p
* \* ?/ s. D, W3 P0 f, n
Minimum = 0ms, Maximum = 0ms, Average = 0ms 3 T! J. ~; K3 s8 K* z
) T7 [8 E: M9 g4 W+ ~- a
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 , y% F2 {. |! r $ H7 I, U" [) Y -n count Number of echo requests to send. * k: q6 G7 m k( Y7 o" h) D" p; g' \ ( K0 x7 D8 r0 m! @/ f
发送count指定的Echo数据包数。 , t6 h# `! D* R: y
4 q5 a+ B/ _/ o 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: " J1 z+ w) I8 d. U7 }; {8 Z 6 K+ R( H0 T" B% D6 v7 M
C:\>ping -n 50 202.103.96.68 & C' o( O4 x* T$ O/ I # U) O c& K6 ?- e3 V& o Pinging 202.103.96.68 with 32 bytes of data: 3 ]1 ]) `2 f( |
! L9 [% M3 z, l: y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 O/ {" P& i* c" l o- J" N " \" R" w: x1 }+ {6 c% `2 e+ T7 V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 z: n' t) n2 @6 B 4 B( D3 @& I$ L4 M# Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 Q6 {( @$ y8 l. F$ a) u
% B' m9 H e; m4 y9 e
Request timed out. ; V8 L$ r/ f' _( v3 w
2 c* b7 O& \( B8 W
……………… " I( p E9 i! a
& L% E9 O' @, x" D' ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 }& v2 G- I, e2 ?9 h6 ]/ o% N* e
* D+ _% c0 D4 h( I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 O4 B% H# U" f/ K3 e! f , E/ m- U2 G7 w
Ping statistics for 202.103.96.68: 8 X3 U1 I9 _$ k 2 j5 y& f1 ^3 z
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # h9 e, f+ ]: h$ J: { : V: _' F4 V( h Minimum = 40ms, Maximum = 51ms, Average = 46ms 7 |* ~. y; r# N. ] - N" {+ N+ G8 g) Z& p
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 $ l ^ W K1 o, U: v: [9 j+ x, t 1 G+ R& [- l* `; C3 w -l size Send buffer size. , r o- j- v) V$ B 5 R; u5 R& Z- b) k 定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54