Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
' G6 l9 }' G* Z$ i! T- G3 c   & k; T6 l/ ~4 N1 E& d
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
+ l# S. ~' l/ f/ ^4 G4 |8 N4 [  
/ o, Z- x, g" [  b6 w4 _4 ]  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
: K0 z+ h, q9 x  
# U" Y8 y/ i4 `* n& z  Options:
4 |# W  I% g5 R' _: p' M   * {0 C: @" s5 K/ M! Z- t
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
8 n% K/ C9 d* _   - {' f* u% y9 m- r
  不停的ping地方主机,直到你按下Control-C。
& Z" N) F8 _3 ^) Y2 Z   4 b# d0 f8 Z. ^& F2 ~
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 * }/ p8 N& q/ n2 W4 j
   ) M  k) @& n  _( P2 e8 X3 @7 f# Z
  -a Resolve addresses to hostnames. + E* `* d  |4 C7 X$ x0 Q4 B' R
  
- X- A+ {, p+ _9 }( m/ [  解析计算机NetBios名。 + p/ A" @6 i* D7 Q) a
   , u' L4 r" I! M  o4 B
  示例:C:\>ping -a 192.168.1.21 " y4 n1 `7 _2 S* y+ X
  
8 P4 b, y4 K' l  x5 K# d' i- m" M  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
$ h, t7 s( p" L5 i7 p  
" r1 J* w) [, [6 q" y: ?  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# j1 A: x4 T0 v4 {0 D   $ d+ P' y+ v& q
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 m) i, ]/ N  R3 i
  
' }. n- E* |; o) ]) D' s  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 ~: u: x% ^/ q8 Q& E6 u* o; @+ b6 \) R) t: D$ M! Y# t; w5 L1 G
   # F+ E2 n# b0 y, B
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 a- ~' M* ~' k
  
! q- j3 n+ F3 Q5 J) }  Ping statistics for 192.168.1.21: $ \: w  X# W# y
   8 c' U2 z7 }8 D
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / J9 V) r3 F1 l* P, D
   6 U5 H5 _8 J7 x# P* R, I
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
* g( M7 }! y' R  I* G( G, @  
5 f5 G$ E( T1 H7 |0 s7 k/ F" N, k  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 9 u3 _! |5 z( ~7 H3 E" t
  
( B* |; r0 v3 D$ N' f4 k  -n count Number of echo requests to send. 7 C# [3 w1 E! t; ^/ y' ?
  
& c  ?" j( o* y" [  r2 V( }  发送count指定的Echo数据包数。
# B, }) l. C5 t" P0 E   8 U7 V: ?& Y, a; f
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 z0 w2 @6 d6 s5 e; G   % @4 Z# b' R  J! X! \) }' ^
  C:\>ping -n 50 202.103.96.68
6 V% W) @7 v+ B% M4 `$ ~   $ j/ M; Z; I: _" m+ }! y
  Pinging 202.103.96.68 with 32 bytes of data: " y5 D3 r3 r/ v$ @. S3 g2 E
   / I; E3 \2 p6 E  ?
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 U2 B$ F2 c- S3 t6 Y
  
. w1 M& D7 w- i- l  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 `6 D0 X* X% ], I0 Z
  
9 ^. i7 X( j- u6 Q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 t) O/ R  p( U: p8 h* h     x& O! K+ M2 Z
  Request timed out.
7 u  f2 O$ d' o' M0 y8 b   , m5 j1 U( j$ S* d
  ……………… ; v9 U% x( [& T  H
  
' ?6 \+ @8 Y4 [! ~# @: P0 B9 b  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# `1 B, J9 ~% ]/ F& h- ^/ C: d1 p   2 R& `+ X- \* c: [2 h) L' Z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# ^/ z' x1 L% n; Y# i  
; g5 L7 \. X) K$ U) L& }  Ping statistics for 202.103.96.68:
/ s* U3 E, R; t; e  
2 J: G. L* @+ h' C0 d9 J2 L' o4 A, H  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . d! c5 ?4 }- n" B; n0 j" T  A
  
5 c3 E) V) n  y9 P7 Z- S/ @! I( E  Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 b' [# |7 N' C( [$ n& |4 E) B+ i/ b  
% r9 @" |, {( j' T8 I: i. L6 X  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' G# C3 g3 Z( @+ j
   ' f( C" S; ^. Q! D$ V. W1 [# J: H
  -l size Send buffer size.
' K# r/ t7 ?9 q  
, r4 K. A7 E* p$ L, [  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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