Board logo

标题: 教你正确使用Windows的Ping命令 [打印本页]

作者: 野人e族    时间: 2008-1-27 22:16     标题: 教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 $ Z# s0 R7 `4 v* \* h; w
   $ K2 C% k2 J  e) o
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
% y/ c2 ~0 x8 H, c  
3 n/ x" \7 R- E- B, e  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 0 p* D# E6 ^+ n" E( p% d) D( O
  
' z. b$ P1 y6 o+ N  Options:
/ r: T4 W, P# H' c! S- @  
& S9 M, d. g: k4 C! W: ~5 V  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 H' [1 I/ P. n; A- W. G* F   & b& [9 v# {8 T) E" A( p& a& R6 R$ f
  不停的ping地方主机,直到你按下Control-C。 4 B/ l6 M# c  h5 ]" ?( @( h
   3 n9 l& L  m6 [
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 , ~' F( ], o7 O3 S. N
   6 T5 I" x  z3 @
  -a Resolve addresses to hostnames. / [! I  J! D5 J4 x- o" f5 _$ W
   7 d+ K3 k. u4 z, F% l  G, f+ Y$ e
  解析计算机NetBios名。
+ ?# O: j6 H' O( f7 k" V     k( }  [, t4 P& S/ @( ~. i6 l
  示例:C:\>ping -a 192.168.1.21
7 F' G- u/ Q+ p7 }  
% j) d- }) I8 H. `) G6 x8 w  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ' v8 v+ d5 C4 v/ s0 A1 S. ^
  
7 w" I( Y7 W1 f1 m/ ]/ k  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / f, \7 l' r$ h; E0 l0 g
   5 W( A) f! Y" e- y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - o$ x: s. \; y1 u- v+ l- w
  
; W3 _. `5 `6 R. ~; {" d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! W% d, Y* o& e

) O; a9 D. f0 r& H( B2 U8 Z   , s6 n( K  x9 `' x, M4 Q) U! n9 j
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- Q. X, A8 F! Q8 S1 g$ T  i     a. d- `' T3 B: A  |4 C' F3 e
  Ping statistics for 192.168.1.21: 6 }7 p$ I( |$ z( r/ b  x! n
  
2 h% u: C# l8 {- S7 r- F  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 v' [/ q, d  q* E7 L) e8 o& N   ( P# d  d) ~: }, P2 s9 a' x
  Minimum = 0ms, Maximum = 0ms, Average = 0ms 2 C" k3 v. c2 H. R& ]) B* u
   ) Q( D( I7 R2 P
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ) p' o: k1 G! p* Z! _( [; L; {
     n/ J3 A  y4 Y0 e- A) ~
  -n count Number of echo requests to send.
. I  K+ h) u9 C, S+ C2 ^: D) v   4 L+ C+ q. w1 h& E4 I! E' ^" _
  发送count指定的Echo数据包数。
. \0 s$ G1 H: o# A1 r1 ^  
) B# l5 H2 s2 K) C  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! b0 N+ e: ^3 V* v3 ~/ m# \* _  H
   ; W- h) t2 C* R! c
  C:\>ping -n 50 202.103.96.68
+ X( D- X) E: Y7 e0 Q1 u) S   & A6 e: r6 \6 u5 D. D( v( r
  Pinging 202.103.96.68 with 32 bytes of data: 4 p8 p7 e+ I. v0 [7 i
   6 ]+ D( e2 z% j+ i* j
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 b' u" S8 x% P. ^
   3 X+ k! e$ A3 P
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 ]7 }7 a& w. \   3 L/ \4 ?1 V: t1 i
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - \6 w, l2 y" ?8 L0 l$ ?
  
3 j, K% p  n, H8 c1 \" E  Request timed out.
4 z5 }7 s: v( i9 v3 G     A( m3 Q4 _! p3 C. \9 J
  ………………
, G+ _: r* ~, P  
- B0 \5 _8 v; S9 e8 f0 d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 {8 T; ^+ a& |   5 ]3 W( u5 Y% j- o* u
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 s2 ]! \' a( s- z/ H" k9 w, ~
   ) `/ v6 P9 V; ?! h! }- _$ V/ r: l
  Ping statistics for 202.103.96.68:
. e& h" P. i( f+ Y- l! U   3 a3 S' H' d& u5 c1 k4 L
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # h- @' v* }! }% H, o  f
   + q3 i, d& b& [
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 M: ~+ I) l+ j$ C   " r0 }( O' A5 |9 ?
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 / N, y5 N% W2 Q7 n1 `3 }! U
  
) @8 m2 k9 o( B: V% L) A  -l size Send buffer size. 1 \; f, J7 }& ]2 k
   : F) j% m4 P# D! [% w
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

强大,但是我看得不是很懂!




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2