对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 2 @0 F& e; C. E* R& p : j6 W4 u6 o0 U6 Z" J F
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 3 v4 J* C3 T: L- V0 Q
/ z. p/ J0 _: b3 d- i/ o 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 ' K2 I2 C( M8 Q$ i$ g
4 G& B8 d+ B. N
Options: ; R2 t) {; `- r. F" z7 y
1 c( _& O3 ^; @% t
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 6 V1 ?- \. N7 [- f0 N
1 d! ?% D8 x! f) u2 F8 @2 A 不停的ping地方主机,直到你按下Control-C。 6 Z1 u6 U1 E5 T9 p7 f( ~$ v9 c+ F
% n6 k; ^9 m) ]8 f( L5 W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) t. a- s! S' t1 f, f& Q
% N$ b% C* @" Y$ t6 y( x
-a Resolve addresses to hostnames. - X+ |7 v1 r1 G l3 P& M3 v% s$ W* u
8 H! @, l- o* U, n4 ?1 F& T0 b# B) c
解析计算机NetBios名。 # a9 @8 s5 v% d: A2 J. b- e& }- F 7 T: E3 l7 i3 h 示例:C:\>ping -a 192.168.1.21 - X n. D2 h' u+ F + p* I) ?3 V2 G6 c. x6 x5 i* i Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # J2 t( |+ g8 a* U6 P
0 w3 @. E6 N" ]3 k' Y: B, n4 c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % m: y3 M+ G/ g8 d
1 h& d& H; v [6 Z5 _- u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # f+ ~' G) j! ^0 |' L
$ e( Z8 P* I' }
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ [6 [) O& U. V* ~5 i, Z4 ]+ F9 Y" g5 q' e# S8 n9 V* n
" A2 N. C/ q) C* t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; B; ?: C, H3 C1 i0 e
; g9 x& T" X3 Z2 }# P1 ?5 u1 U8 J Ping statistics for 192.168.1.21: + z" U2 W( u# N 9 ]8 B7 V8 n: C' p7 Z* \: G# U Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , Q0 n: P. C, @! q6 p7 N # [! k0 C' _& j/ E1 v
Minimum = 0ms, Maximum = 0ms, Average = 0ms " L7 C4 D+ Z' l: L' ?
* H" O0 w) U* X8 F. s( V 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 % g0 O! {( D2 a; I8 S! n 9 C. F$ [4 _8 n -n count Number of echo requests to send. " Y' N$ t2 }3 r- R8 ]9 o& T
& O' _7 x7 Z# K5 n. R; Z8 j
发送count指定的Echo数据包数。 : s3 b- }( Y; g" z) \
8 ]1 O- Q( B: n* \
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 9 R- Y) O M8 l# F' V6 \
: z. a8 W& T3 b; y2 x" |& } C:\>ping -n 50 202.103.96.68 # F& q/ y. K6 X+ C
! T8 Y. @1 z( B
Pinging 202.103.96.68 with 32 bytes of data: ' f! _, v m- V* M
6 y2 O) s4 R( J7 Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 p% a) U+ D& q - H1 C8 J0 b$ ?0 c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # U/ m8 R I% J " @( d3 c' P, }* O4 x- n1 Q* S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; ~& F0 p3 V- m, a( Q7 D 0 Q. I9 w# e1 c- w, O/ |" i Request timed out. " F) v0 G) m! A& H8 Q$ \3 Z . w) x# }7 z0 S+ Y5 v
……………… 2 U- [# H8 j: @; | & E) K6 L+ I& J. N" d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ `( x; b- j! p; i6 W6 k6 P! a* n2 O
! X& t0 [' s6 r+ x( A$ C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + t8 M4 G! b0 ^6 x, |7 ?/ X / W. C8 L7 E. i$ J, o Ping statistics for 202.103.96.68: `4 w6 t+ a9 G, i6 ` ( i u; I9 k8 ?9 G) m
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: Y: }$ z* o" p) h" P7 J2 o3 |
, F" }+ O6 P. d" R' i5 C+ f7 i
Minimum = 40ms, Maximum = 51ms, Average = 46ms ( |0 P( Z D* V9 D6 P2 R