Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! a  S( C% S" Q/ ^) ]1 F
  
- c% I5 I" H7 `$ n( Q* a2 Y  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 6 p$ _) a, B8 W- j. t  m
   + E4 V: I. J' a+ D" c+ B
  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 3 t  B- D! e8 t+ ]6 n7 t' B
   7 u6 X) _  k( }. c4 J& `
  Options:
0 U6 j% [4 Q7 V/ i  
/ A5 g9 ?5 r( G* d1 F2 q7 A  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 v' N4 Q: U  x
  
7 \* }0 u0 N* Q* N  不停的ping地方主机,直到你按下Control-C。 * r$ q+ c5 W" \4 p0 W
   1 A0 t; h- k( O/ _
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
* m" F! q! F# M' S) s5 i   5 a0 F7 o1 \7 B! _7 [
  -a Resolve addresses to hostnames.
8 |3 |) Y! r) c6 R# ~! q- D7 ?6 g   & F& a1 O7 l5 W% I# a2 g  h" u
  解析计算机NetBios名。 + r) t/ j. r- \9 O! q
   * Z3 y' i* _: d3 v- J. U, m- Q
  示例:C:\>ping -a 192.168.1.21
8 T0 b6 L$ f' n/ u   - k8 ^" @, _- I" y0 @& v( v
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 D0 ^1 o2 K2 E5 F2 }& l) I- c
   1 Q' P3 }2 {* o  o1 G& e
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ E! a; U) `, H* @" w; E7 Y   ( p+ E( n' Y3 }% D0 E4 u! n. x
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 G) B0 F, E/ k$ g; _$ e5 P* F
  
2 G+ B/ M( y5 `1 s* o7 ^5 w4 h  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( u* o; j" c! a  h3 m( f% K. ^3 K

: s- u) D/ A8 S0 N) y# L1 e   6 u- J- h8 [; X: E. j# k
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 D/ p! U0 o. \6 h9 Q8 K; z. s   . E! v. c  E+ d! P7 Z; I2 {" V
  Ping statistics for 192.168.1.21: ( z& z/ S, m  P! I1 S( m: G% K
  
; T* r2 U  P# ^$ V  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 X; p+ f2 Z# r( F" l
  
# K: w- u# e1 h2 |0 O* [- h% V  Minimum = 0ms, Maximum = 0ms, Average = 0ms
) E. _6 |; B% {' G  
8 w0 Q9 X5 n* u9 D, [8 H  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ( I, u* ^0 w; A( l1 o; V! f
   : T# \( {: r' t, j" E
  -n count Number of echo requests to send.
5 a$ h2 C1 M* L" M3 _5 R3 b- w$ @  
# M6 }5 r9 Q5 b% G6 P/ [  发送count指定的Echo数据包数。 / U& L. U6 D7 f, w6 e0 r
  
1 Q: B6 W, p( h. j: k  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
+ o- @: E: V  _' U/ r1 q% j8 c: M' ?   , r* |! n; R' d
  C:\>ping -n 50 202.103.96.68 : _$ c- o0 W/ Q- B( }6 B, {/ G) A- {
   * ~! z( @. f, a3 Q* z- ?6 _
  Pinging 202.103.96.68 with 32 bytes of data:   j" r( |( R: A% x9 G/ S3 h& J
   + S# d& r5 v& c7 S4 w9 m0 D
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 B. d& \  b; C+ q
  
3 B: H5 `+ B! c" F  s  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 o3 p( y4 ~9 n# x
  
7 Y4 _9 S" g: [9 ~6 _  ?  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! Q; v  g4 ?# A
  
; ~6 e, e: ]. X# z  k/ a( E+ w  Request timed out. : W" z* T* ^: c1 q
   " l6 `# F" ]; C2 r4 G9 e! A
  ……………… & \) Y. u) F" y( `/ o. l! O
  
; d6 X' k& \" ]  p  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 L! P8 R8 X; X8 H  B% y; d  
! A5 V% U" P% m* H4 B8 @  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 [  X3 z, Y: `' G
   % ~2 X0 X% H6 A
  Ping statistics for 202.103.96.68: $ Z( {6 w. u5 x9 S
  
! ]- ?# K" O! M1 d. f1 H  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: + ^: x' E) }# q- s
  
. T' @- b8 x! {9 z, k  Minimum = 40ms, Maximum = 51ms, Average = 46ms 9 E1 O$ a* B" V8 |7 F  g, d5 g
   . y- ]! }' l6 H6 X# o7 P$ G
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
7 ^5 L. b5 H( I  g' |   5 [' k7 o: @  [+ e
  -l size Send buffer size.
' }+ F# `  L8 d2 e9 j* o& t: I6 \   2 @/ f2 [2 P4 K+ ^* d/ `
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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