Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
9 b; _) F5 ~, J1 d- r! U& N  
" R) @7 {& J4 i  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 [* g/ x  W6 G0 d2 M0 B
   4 |7 w, h: w+ W) H. \4 [1 i# s
  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
' ?7 L& K/ U' k" ?( g- |: m  
0 ^' C# l' I  V8 m) C  Options:
$ L( }+ V0 P. {% B/ k# d  h: W   . H6 A1 R+ G7 |! C3 a) l1 x  z
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
, D+ S* e) O% ]6 _! x! _   & ?$ g  C6 R' R+ r
  不停的ping地方主机,直到你按下Control-C。 ' O$ y$ ~% d" O9 M
  
* }; b0 j4 i. ?* b  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 C9 `4 B! h$ Z2 p  
+ |- u+ n: n$ U0 R8 W( {  -a Resolve addresses to hostnames. & M' D, L$ {/ G! ?7 g$ T% m! y) H
  
( m/ V/ a% C; {/ j+ d$ j9 I2 A% U  解析计算机NetBios名。 0 N# M# e" b4 z5 z. m6 K
     s5 y. e0 A! X) l. O2 d" M6 x
  示例:C:\>ping -a 192.168.1.21
& B) m8 ~* S* F; s7 ?7 f1 V2 |# W# [: a   1 j* l% z  }' x8 Y6 K
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 k9 U: ~/ y2 D! q6 [; t
  
: h% K3 ^6 ^$ m' _1 R0 O( C  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, A& F# @: Z( h2 {   . H! l$ D' s! B5 b9 e/ ?
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# W2 _' t2 v. ?3 p. B   ; e8 H: O$ h3 \. g$ T4 m1 k. b
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: m: @/ u0 k$ R) Z/ L1 n: r2 B
/ e/ F) a8 E* f   . l! y4 H! q0 Q* r7 j$ Z) t
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ ^1 f% D  g$ y) n" ?  a  
6 `2 N7 {7 b+ x* [  Ping statistics for 192.168.1.21: 2 |5 Q) g# ~8 N* O* y
  
0 y. N, N* s/ O$ ^4 s- }( ]2 b  W. a  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 f. r  h4 S7 K2 q* q/ X4 P' Z/ v
   9 C- G0 ~/ ?' q+ m: |: i4 R
  Minimum = 0ms, Maximum = 0ms, Average = 0ms : s, @( t5 H! u3 ]" e. J% R
  
. p- E1 f) c1 e' g! @3 L$ y  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ; ~6 W& P/ I0 a8 }7 X
   & v( \9 E5 f7 Q
  -n count Number of echo requests to send. " r: h9 V# _* B. `, R( k
  
7 O$ A2 W, ?7 M& ~2 z  发送count指定的Echo数据包数。
9 _* C  [1 Y/ M7 W' u  
: w& n' w+ `' N& d" s) x, @  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 a# C8 G  c1 r   : D4 O! j' X0 u1 M- M
  C:\>ping -n 50 202.103.96.68 8 ]7 o, S: G5 }( j2 }
  
& P/ V" F9 v1 d8 g3 t# O  [  Pinging 202.103.96.68 with 32 bytes of data:
; W! {- H/ O7 t( {& s  
+ g2 Z  D) k$ M, x5 g  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 L5 d( @2 N' x& M. m/ c7 k+ ]   5 y; j, f8 V0 V
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 k7 X6 o' s6 |  W6 s     J( ?' d% s; H: }' E
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 Z8 N5 ^: l6 z+ L   / U0 s: q! B& s8 v# U
  Request timed out. 8 b+ E9 C$ M" l$ ?! w
  
& q" Z( u! ]  E/ g  ……………… 8 Z  t( i# ~! V. x, w. C2 B
  
7 C0 K) U" ?' ~. q! R7 c" G  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & R' D& P: I( I, @% e4 {0 |0 H
  
- H/ }; ]8 f; J+ d1 ~1 E  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * p( G# R% F1 f) a. J& n8 U
  
$ J. `; L# Z! f# c% ^  Ping statistics for 202.103.96.68:
4 H: n9 H" y; S. q5 ]9 F   % |) O* Y3 g1 ~# b& M$ x
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 I& Y% k3 g6 a, C8 s& M
  
/ j8 P: o7 j" N/ D1 A  Minimum = 40ms, Maximum = 51ms, Average = 46ms 1 S; V6 h! j3 u  }  ~6 W# w
  
' D8 @0 u( K, ?# Q3 g. k. z  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
6 y3 e1 J3 ~! g6 _5 S! x   * O* ~6 |$ B# h0 s
  -l size Send buffer size. . S3 a, R: V" }$ R
   1 E3 @& k. W$ A2 I
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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