& E$ p$ r% _0 Z0 X; [- V7 ` 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 W5 k9 z; g( i' ~9 B A ) T9 \1 x0 g X 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 . z0 I% d- B9 g, j5 m6 u- D, p* l" F( o
+ L( f# ~- M( ?# e+ [
Options: : |, g* \& o) J6 \' i0 ] . q B1 g6 `9 P/ E% U0 @ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 \+ s( ^: j6 E5 S# ?( h" H. } % T" y1 S9 `7 m3 M 不停的ping地方主机,直到你按下Control-C。 ' c9 b( _" v. r# k , I4 M2 n0 B/ O. v, H
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 6 n7 d/ k, ~" Z
+ ?2 U9 h* N' \ n/ v; @+ ] -a Resolve addresses to hostnames. 0 G. W0 @. V2 |- R1 m : M8 i$ C; }. s+ u' ` 解析计算机NetBios名。 0 T4 D1 Q7 `! v8 G8 }' w
# M' P: P$ X# G: U! c% N+ K 示例:C:\>ping -a 192.168.1.21 , i, Z, N2 c' g( b; g/ n
9 T; d" m4 h+ l
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( @3 w& i+ X6 o& q$ X 7 J v7 W- _8 l6 R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 x$ W, `4 s r6 F$ w
8 E( U4 \( t( o3 r/ ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - l& W! B# c/ q+ |; B1 \
/ r+ O& \) e3 c7 W3 ]' l
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # {. ]! A2 ?) t. Z: f
m$ @8 {4 R0 s6 @7 L
7 y% S a. @4 \$ q$ S# n' [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 E8 f( e& Q, b+ `& W- i . H- z9 g8 @( w. Y k9 ~: J Ping statistics for 192.168.1.21: : Z& t/ e& \" E+ L; f& X0 M 9 [: X3 Z1 y. r$ Q( r: h
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 B9 t& [0 e2 H) q# j
9 n3 E( v) D! e% I. o! P: l& K' i) f
Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 P2 x; e) G+ O+ V# K" ~6 i4 w 4 I* a& y! p5 W: K7 }7 n# t 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 5 T2 K2 m+ b& z/ @4 L, E
) ~" F6 B) B5 A' R9 g/ |, l) q -n count Number of echo requests to send. . t2 O9 I/ {+ I* M3 F 5 Z; G |: `2 g% B9 d
发送count指定的Echo数据包数。 $ A: v) ?/ T% X& f7 E* y! x1 p " k0 a3 b6 \, h3 I 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: " v5 [9 P# q5 z8 Z5 _# f/ H % S/ g* s6 V* S( J. l C:\>ping -n 50 202.103.96.68 9 l4 P. y4 v1 a4 I8 g5 |( S8 m- O s " b, ]; g! z: C6 K$ b% {- _9 i
Pinging 202.103.96.68 with 32 bytes of data: * d; Z# o+ Y9 S5 L( X
2 s! H# ^& N% }# Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " N6 A r' Y' h U k+ A. M: p 7 e+ L$ {" g( ]# f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 J+ C" \" e, O; _" P
1 J. m/ F0 O- [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( N* a5 t! o8 d. n; V9 c
6 j! [, n! Y- h' K' ~. l# G Request timed out. $ A: a' |$ D& _2 ] 5 }7 F* w# I' r& h3 K ……………… * A! k4 O& v- ]# a8 Z . }; v# L! l% K% B2 W4 o3 ]2 e& C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( c5 N0 R1 s; s+ o- F
7 o3 k, O6 e: Z/ l* _! _0 G0 K9 Q5 _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 W; @8 b) |; Z: k+ f
$ @* v# p2 v, u! q K! `+ f6 I Ping statistics for 202.103.96.68: ' v- W3 d( ?' L' [ : j5 F: f6 i! C( G9 [8 N1 ` Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ) j1 U+ v t8 P6 i" g% p% @
6 f G0 B5 {. I3 ?/ z: `1 R) N2 @
Minimum = 40ms, Maximum = 51ms, Average = 46ms : t- {8 O% B) E5 m5 @) e
: E. t% n: _% L* D% ~. l( F 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : C4 }6 V' @& P
' q% w$ u9 P! I
-l size Send buffer size. 8 R) ^! m; R, L5 _& s! C: A2 Q