Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ `) w$ {9 F2 e, X9 V* G8 L  
% B. x1 M! C& ]. x. a- w  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: " O9 a9 P( \2 v8 r, W. M1 r  f
   ( q  z* {' n& V* y
  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 , z/ {. ?4 U. `0 n5 x' N
  
$ p9 u8 u# @& U  s# o  Options: . _$ y; B! Q2 l# J. |) L! K' T
  
/ W6 m8 y" f% `) R4 G; q* w/ {  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
2 }8 i6 [+ [: H! Y  
0 @$ f& K; b3 _# P: C$ z  不停的ping地方主机,直到你按下Control-C。 # e- Q' `+ e9 x5 l
  
2 m" K% n! D5 _- @  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
* W* b. c( V. T# t  ]  
( h, y( Q8 l0 }# P- [; Q  -a Resolve addresses to hostnames. ( o: e" U. R  Y! j& T( w
   , Z% z. M: B/ L# j2 y) O
  解析计算机NetBios名。
  p2 T/ @( o0 i7 C( Z  
8 W" @/ U% M+ L( f; K. I! c% R  示例:C:\>ping -a 192.168.1.21 & ]2 R9 G8 ?1 ~+ x' j, O
   * o4 @& i) o) c* ^
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: . t; P+ R  D4 l) Y6 L" ^( i  ^
  
0 M7 A% u4 t1 R  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! C% B2 ^' T, I0 m  
! X5 w. o% p( U/ o% ?' X  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, h) b3 \) r, J6 J+ Y7 x( c' r- v   / e1 q- I* K+ Y5 x$ H
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 S! S" `7 R, Q7 r

* _% p4 `% K& x5 O7 j   5 G( A% V7 q/ M* o7 t
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 j2 f9 s+ V' \; i
  
! H$ G) n3 D- b/ w  O$ O; N3 h  Ping statistics for 192.168.1.21:
7 g' f5 x* _8 m" z4 b   4 T# z/ [+ P: M$ ^
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 F: j) d+ O6 B9 P     q) Y& T3 t- S6 Q7 [& a
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
- ]" j* Z) C0 w  G1 A# I, @# Y. C  
) s0 b' T4 I2 y0 j) \. ]" |  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 ]  R" A! A4 H
  
' \/ r3 e# Y) c( ~5 q; e4 @  w  -n count Number of echo requests to send. ' s# b8 i- i9 f! B2 |$ U
  
- E5 |' z7 z! m4 y" b  发送count指定的Echo数据包数。 - D. X( A) Q* ]- r, `7 \
  
. Z# Y1 W" N, b$ P- s2 J  \  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
: k" B3 ^; v2 g+ H9 u  W  
  ?% \9 }- j& G- a7 B- v  C:\>ping -n 50 202.103.96.68 " V5 _* i+ H2 }8 E& n6 N8 s7 ?5 ^' k! p
   4 K4 g* H  a5 N! i; G- M& E/ |1 ]
  Pinging 202.103.96.68 with 32 bytes of data: $ A5 k" E* |' U  r2 ]: l. j
  
+ R) Y# C. O' x# d4 X+ f; p  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( z' {( q3 T3 N/ j/ M: Y  h1 n  
0 S- i. I' p1 C" |  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 h: d  }( I/ M- K) G
  
4 w% I# q( G- k/ b  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* `1 @0 I' ~: Y$ J7 ]; F! E   2 b0 i; C( p/ P+ D
  Request timed out.
( Q  T, h) |/ N( {% S+ n% ~  
2 v. J3 s' W! `) {3 |( h- e7 @/ ]  ……………… 6 \" G& W" U" \6 w/ f
  
0 B2 Q! w# \6 }; n7 d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( ?7 c9 P1 h6 E* w   7 c: \8 s0 m) c8 ]. N  V4 s4 W
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) Y4 X3 I$ y" T0 `& L0 e3 j  
3 s; v. K; _' w# r) W  Ping statistics for 202.103.96.68:
: A" u& T3 @' q+ W1 @" q0 G/ G  
) ~! K  B4 y4 `  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 ?1 e! P5 K4 _   # |& j4 l0 n+ C2 v* D" z
  Minimum = 40ms, Maximum = 51ms, Average = 46ms & j2 \$ ?9 ~6 f2 ]! v7 C# s- |
   2 `. d9 r# F6 {9 B. X
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' T+ \( B2 a% A4 k
   9 y& C' L  H' H$ q2 U6 P  d
  -l size Send buffer size.   N- ]0 r0 t& U3 p5 l
   6 t/ s( M% E9 q7 p, E) W
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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