Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 h8 O- q7 s' W0 |$ f6 y2 A  
, ]1 N' d7 }: @" s  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
% ~2 g* P2 H/ A  
2 I/ T6 C/ t0 Z' [( A/ I; N+ f  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
( y" q  O/ e* ?* g# ?$ v  
4 {: j8 K# U4 o) h4 ?# g6 @/ T  Options:
% U  a( I& L' W5 h" }. w9 i   & [% U. q+ F: K1 w$ z1 n
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
1 v  z9 O' x" ^7 g9 v9 A8 F$ b+ E# K   " b3 K* g; W8 ~$ u
  不停的ping地方主机,直到你按下Control-C。 ! n0 o; G( ]7 ]. ~3 L$ f4 E2 }
   ' T' v# x. R- ^. z3 N) {. F7 n
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# w8 d- t" C& M! |8 r  
1 G! z5 L) P3 v0 J0 X9 o( H3 U& I  -a Resolve addresses to hostnames.
0 H* w- m5 k8 e8 @2 ~+ r  
. w/ i  Z: r2 x( C  解析计算机NetBios名。 3 u7 F5 `0 G$ B1 X' i! b9 ~
   3 L+ A9 l- u" Q
  示例:C:\>ping -a 192.168.1.21 8 h- `" o3 \6 r; M1 i3 Y
  
' j7 z1 d' |6 z4 w  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: : j# d# m$ ~, ?7 @' }
  
: Y8 \) U  X; Q9 r& H, P4 c  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 ]6 Y  U- L( h/ s3 [4 K3 R
   - k0 y8 }% _. S) F; |
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: h( V! v/ Z/ J4 [) g/ F; y$ ^   " l1 G7 P, B+ K4 T' o2 f  v% A
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 P7 x3 K6 [* m8 O# n# ~: O+ M+ K8 d: b2 a- O2 W8 s; I
   : @/ n6 r2 {' }/ v3 i1 q
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) C* d+ y. C+ M& _% V  O4 P" w3 @6 Y2 d
   6 G2 x: j; N1 x' O* d* k
  Ping statistics for 192.168.1.21:
/ [; E1 N4 E0 v9 e$ E! \  
' j! D# ]  R1 z+ Q  c) H. P. A0 P7 s2 H  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, d; N8 v. u7 k' g   1 ~9 I2 ~$ [( ^5 f1 b3 b4 f& m3 e
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
9 g0 ]9 |8 u* L( A2 X  
( \; N* p' r1 r, w6 Q- b, C9 P  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
' A/ D+ I0 o1 Z" e   ) ^8 {2 E* K" j: T* z8 w$ p
  -n count Number of echo requests to send.   s1 Y3 [: `( J% y
   ' n9 ]& E6 Q0 `
  发送count指定的Echo数据包数。 , T+ ?0 n% N- E1 [& N) r! T
  
7 Y  z" L7 o* p+ W  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) s9 }5 r  ^  r3 J3 s8 x! A7 k   ; V. z# L) y$ V0 ~4 M# l3 G" y7 o* q
  C:\>ping -n 50 202.103.96.68
: z7 I3 K4 w* S" |   # @! g7 I! r/ t: W* M- ?
  Pinging 202.103.96.68 with 32 bytes of data:
" O+ f6 [& a9 w: c4 J     C2 S$ `% L2 |7 ^9 q+ g
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" B$ m2 A  s* A; d   ! n2 L4 }+ h! v. N. f
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! Y7 `, O" y2 z' k9 G   6 m; F/ z: o: N. Y3 L! n7 o
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, u7 O" H/ Z; U   7 \0 B# S9 q  K
  Request timed out.
' v; n" Z0 D! g' w. E& L/ A  
/ b6 C% p; d  `  ………………
7 {2 _- }: ?. k  f  
7 [, A, V3 B, N, S3 a  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : S3 l! ~* [0 @
   + {$ m9 F* S+ j4 I
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . S* R8 {: @) v2 j5 d
  
% R; n3 }& F( d  Ping statistics for 202.103.96.68: ) y0 h2 t* n+ M) w
  
, D: E! K% D6 V" H' X. g. v- R  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ! X; @, `* n7 k9 @6 d; m. I
  
0 a5 j$ Y2 N9 X! J! o' ?$ a/ x3 A  Minimum = 40ms, Maximum = 51ms, Average = 46ms 8 h* S# B  t# ^& L4 ^0 W
  
! G, [5 }+ q7 e: H/ O  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 & A! V% I2 l4 ?  F. F; y' n+ }
  
$ p1 T! d8 d9 U  -l size Send buffer size. : a, [$ H: W6 g- q
   ' r2 U  ], {, m2 u
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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