Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
% D9 u8 X. E: S  K) h% O+ t   3 h' ~# [8 K! [  X
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 `+ H5 X7 A1 G' h' h' h+ y# c   ; m, z, o, y9 i1 m- r
  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 1 ?7 z* d1 R8 o* l, G' t
   2 w# G8 R: n7 p% [+ m) Z) f
  Options:
0 V/ q  v4 f& W/ n! L  
' f" v  v4 j- S  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ' }$ E9 p) f: P0 G5 X3 z5 h/ p2 q
  
: K) ?$ j+ c% d9 B5 M1 ?- H* Q! Z' O) l% x  不停的ping地方主机,直到你按下Control-C。 : N, W7 g, G* a+ \4 b6 H4 e
   ' J# Q- q% M4 q4 `0 S
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ; |3 U% s5 i% [, r4 t
   $ I2 m/ ]7 E" o6 w' L# c/ d
  -a Resolve addresses to hostnames. 3 \% F" f4 m4 M2 B/ c: p* o. {6 y
   3 u  b7 N& M: ~
  解析计算机NetBios名。 6 v4 w( ^9 p! E% @
  
3 x: y) s3 U/ J: X/ i7 j  示例:C:\>ping -a 192.168.1.21
3 Q* X; @- t0 `/ |! ]  
" Y' s/ H  d# T# M1 w, g  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 5 `4 N6 `2 [6 L) L5 g0 {: k1 }  S
   + p% K! i& F1 I8 J
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ [# }# N: S# x4 m6 s! [8 F: ^  
2 I9 @: ]7 E8 d' z  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 T% c$ I& q# P+ Z/ e7 ~
   4 b0 K+ d2 _7 i
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% G$ z3 y$ f' p9 o8 k. x  F3 L2 L
2 b+ y" H- i! a7 L* E   5 q- q" |. ]4 _: F$ x
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * h) G; b5 t' o2 _
  
8 I% Q3 c7 ~# }/ x$ |1 J  Ping statistics for 192.168.1.21: , ]; V1 G5 T. {% \7 N/ ?& L
   , t# u& q* k  D' _2 }
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
' V* A) r% I0 T8 H9 q  
0 o  T. Y% y# w# K  Minimum = 0ms, Maximum = 0ms, Average = 0ms
  i% r1 }" H" r/ p) f; q   . U7 ^( \; E4 Y/ P* V3 a4 q
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
- M* `; A' u9 p; e( x  
: O  i3 |% ?0 _6 H  R2 M  -n count Number of echo requests to send. / X& o: s5 O4 d; F1 Q/ A
   ( h7 p" t' n! K& u, r+ q( N( k
  发送count指定的Echo数据包数。 * l3 C; F2 L3 ~/ a0 w9 D
   3 y) F, |4 K3 d8 x: V$ o
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 r- ~' A( r$ G2 W& |0 ], y& H   ' W9 S0 h! }1 X% f
  C:\>ping -n 50 202.103.96.68 ( S6 G3 e; l* ^  e3 Q; |
  
/ [/ X1 b4 v7 V: w2 M! F  Pinging 202.103.96.68 with 32 bytes of data:
3 x, Q3 J  c/ Q( A  W/ J! V   ; K8 v% o. |% {( \0 F8 J$ w
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 F  u4 ?9 L6 Z% p, s  c1 j/ p  
$ Y5 g9 r! S, C' i  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 f8 x* N! D/ {) {( m   ! r; L5 h- l; M: m$ v- x. I
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  u6 e; z9 H( D' t4 R& V" ]  
( {8 l8 }* }: X2 |, ~, ?( c4 |  Request timed out. ( [4 E: R7 t" b0 }
  
9 h( z  v! J' \& ]( L: u  ………………
$ D5 w+ q/ V% B2 M0 S# t   7 O3 ?: `# A5 J% U) j: w
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 y  f$ n, q* q/ b! ?   . u0 Y6 h) t) ]- Z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ @- w  g& l8 j* [& j6 I0 @+ k
   / K6 W; s2 u% o
  Ping statistics for 202.103.96.68:
" a- A2 N2 U0 @! b" }6 {   9 W! M( V% K& w
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : T' ~  n+ R: P5 n
   $ a! P* X+ P2 q& P
  Minimum = 40ms, Maximum = 51ms, Average = 46ms % m' S* x# o  N2 \: y4 {( o
   : D. U* @! t' t1 V3 ~
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
* H8 T* t- A' @2 [4 U9 `  
9 X  l( w( c! a  -l size Send buffer size. 6 k& J  g% m  C: v8 R
   ' k# {) ~7 k% P% @' Q
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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