Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
; `) ?, K$ \& I& H( U( ?  
# @  m& T1 P! J# }. k% V) r  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. {  ]( Z& c4 ]% b. V. h   4 j7 `5 z0 n4 c  T
  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 % b! R* k9 I! i7 h2 ^
  
, p. I8 M( w8 E; N4 i$ H9 f; d  Options: ( G0 k1 ?2 w0 q4 C6 U) P) N
   : l( S+ P2 f- o" Q
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
; y8 {0 @( n3 f' e) r  
* k9 e' b' k1 i! v  不停的ping地方主机,直到你按下Control-C。 , M5 ]4 Z7 F& t/ h5 _
   0 Q$ v% b2 C5 J) C1 A
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" u6 F  }7 E& y( P  A/ Q; b   8 i" E* C+ A. Q2 C% N/ V
  -a Resolve addresses to hostnames.
2 U9 z* x3 _% U: m2 D  
8 p! o$ `* b8 d% m  u  解析计算机NetBios名。
2 S/ C+ E0 R. c" B7 H( y; |  
7 i! }2 j7 B8 Y# L7 }, W, S: [  示例:C:\>ping -a 192.168.1.21
- O2 @( Q& _" C' N3 V& [# I  
, t6 [6 I: U1 s( H/ J% O7 J  L. P  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 g7 x2 D8 |/ x7 V! i: X8 G  
, A- o9 T3 {) `# ?4 V  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: h7 b& x* ~8 N) s. b1 z" T   / R+ B0 L+ {! v' I& g
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! E6 m) \2 v( I  
( B: N' r7 x. W9 A* h  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, `; W% p8 H  s! o. \% M) ~0 h  u( V
2 B% w$ |2 u: z* m+ J   8 [  c* Q3 d! a2 y$ o- a! h( X5 c
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 r, {1 m5 X' G+ G2 e. v
   " U7 K* S( ]4 n
  Ping statistics for 192.168.1.21:
9 W% R& t, t7 H: i0 }# |  
1 r8 ?2 _( j: j6 K: F+ h0 E! }  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # A4 O1 \  G5 O2 x( s
   - S" T5 c/ P) S: \& V
  Minimum = 0ms, Maximum = 0ms, Average = 0ms . W9 _1 T# U- a# e
  
8 H5 K8 `  _: h, o  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
3 m4 e6 S7 l- u  
5 v" m6 {2 h# B  -n count Number of echo requests to send. ( [' g; w7 g- g
  
: V, G8 Z# k+ q  发送count指定的Echo数据包数。 " S% b) I: s7 b( N8 ^4 w" J
   2 e* j* s/ V' z, V7 j* T, X; P( ^
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: , Y# L2 @( N7 H. i
  
& f: e1 M8 P% p" s  C:\>ping -n 50 202.103.96.68 3 l1 @* e3 f' u
  
- Y5 p/ Z+ `" ?4 i  Pinging 202.103.96.68 with 32 bytes of data:
# U$ w4 i* m0 ]; U  
" e( A- O& Q" p5 @9 m0 q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: p% i5 W6 c6 h0 E0 a   % q+ `  c; b, Q& w
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; v! v8 m* p& K   8 C2 o+ f6 F* |/ c7 g7 H
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 X$ ^3 K7 e& O4 \% m; r6 K
  
2 `# B& k% o( |6 ^2 l% V# F  Request timed out. 8 l5 @6 C) s) J+ j9 z  ]; M
   * R$ I& }0 `+ t$ g
  ……………… 8 v+ \6 t8 C2 C* ]
  
5 m0 r  k4 B# g  e1 X2 w, g, K  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 t3 M) s6 s" y+ W/ N( d5 q3 e
   / m0 I9 C; p6 r- S3 h# T
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 g6 ~1 B" j. i" d& C# i  
" n( o% Q3 [( `, S  Ping statistics for 202.103.96.68:
6 Z! b6 `0 e  j6 s/ }( O0 G   # _6 o" H6 Y# h
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% U1 W5 e+ ^- f( ?4 c  
, ?+ }; K: x" \# c; r% G3 k" v  Minimum = 40ms, Maximum = 51ms, Average = 46ms
& J1 p# }1 Q! K) Z3 D   2 `* c6 a) `5 p/ i# n* R
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
0 \. H) y! }1 p7 U' V  
# S1 l; u; j2 v9 o  -l size Send buffer size.
3 P+ r, D4 M' f$ e2 U, C  
2 Y8 q3 N; C. ?+ Q  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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