Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
! o, f6 o2 }0 P/ \7 a: @   3 @/ R( y/ t7 z4 S8 M) t/ i
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ {8 n1 d4 w1 c; t& r  
0 h3 ?4 h+ x! Y7 m+ [9 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 ( c, b7 I0 }2 w( I9 k
  
" D3 L: ^4 C' @2 h. V  Options:
0 X$ O7 ?1 s. k7 r, X* @2 Q  
* u$ O- v" c- J. ]! ~' |  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ' t9 T! @2 D) I( |# w
   ) |8 Y  R# c( P! H# L
  不停的ping地方主机,直到你按下Control-C。 . v  t/ u( M+ ]) o$ W2 U
   ( k! y7 ~4 u; T3 y5 E6 ^5 Z) a
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" v  `, {, [8 Y9 ~( D% X   * e' {  k+ q2 H+ ~& ~3 ~
  -a Resolve addresses to hostnames. 8 l2 P' P3 a9 v8 t2 j% a
   7 t. m2 f. I1 {8 w2 z9 w' A
  解析计算机NetBios名。 * d" h# ]4 C: ]- d
  
0 y7 Y, m1 Z- }6 C: b  示例:C:\>ping -a 192.168.1.21 0 O5 C& c- y. N+ [
  
5 o1 L4 |: X1 S$ E* D4 A+ d& e  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
+ t2 p) V4 {# E! t  
9 T+ ]. V  T& c  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 ?2 h/ I% n  e. \   % }  d) }; K7 c7 S7 q/ e5 x
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" v5 T' _, q+ O+ X/ U+ n  
/ _/ M$ x5 D: [2 E: v  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; Z6 T7 ?8 F- j

0 h! b- s  {. d4 D7 j   4 S! L* |: L9 J
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! b* t0 {6 P! L* I& f
  
8 G- G) H: v# o  Ping statistics for 192.168.1.21:
3 N( r7 H/ u& s2 P- r  ?     [9 ^! d% a( W9 Y" \
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( n+ c7 U+ E6 o( J/ H  V1 Z
  
  n+ |0 Q9 k8 c9 e% J* F) `  Minimum = 0ms, Maximum = 0ms, Average = 0ms
' y2 j" n) o/ f     F4 A0 h7 `6 S% Q4 N
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 t, B5 \& h  u% V4 P( H+ m   : P% @& O( i0 B* Q
  -n count Number of echo requests to send. 4 E! O% a1 n- u
   , C: i* W- S! D' n6 m* x# ~7 e
  发送count指定的Echo数据包数。
% V4 K* \1 l9 _/ |# Y   ( T( w& K+ {  A0 y
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 c  \" ^: p& w4 T  
4 ~1 X$ q1 N$ K3 e& V" f" f" E  C:\>ping -n 50 202.103.96.68 " @- ~  x! M" k. J: [1 r6 d
  
! n& F" d5 l3 W; x3 x  Pinging 202.103.96.68 with 32 bytes of data:
. ?( O. y* L4 n0 S. a   ; D7 D& N( i1 \- w9 e, ^7 a
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & B5 r( k8 d. F; L
     s/ k5 Z8 O' ]: z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 A2 ?$ j% r7 Y: {
  
# ^1 s1 _7 ^. N( U& y/ W1 d' J/ }  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ ?/ e+ A, a% Y5 T
   5 f5 |7 y/ _6 a. c; e
  Request timed out.
+ S. `! |8 k( u   4 j1 O: ^4 E& o
  ………………
: @( A+ a. P1 N6 r% z$ V0 y$ Q  
! a9 M3 F! C+ R+ l4 Q" l; p  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' @# X0 f6 g5 p4 L( i0 @  
6 F, s7 Y- `/ [  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 k# f" N8 h2 s% G( r! w
   # R3 U0 k0 e' R' X8 |& s- [0 G
  Ping statistics for 202.103.96.68:
8 H+ b  O! o" }( i3 ~; F  
5 I- F3 J, t% o/ {! o+ [9 H1 P1 F  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - ^% u' _8 @1 S/ w9 m
   2 {: X4 [9 @9 v2 I; A! J
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
0 ?( }1 s6 Z+ g& |' F/ T   + _  B$ @1 b. f- t0 ?6 h
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ X" n, o0 O3 Y; b) @+ Z: i- ~  
% w4 O2 F, f$ h  -l size Send buffer size. 6 B9 S( Q8 V- I  b' j2 o
   . k  n  @5 ^1 H: I8 @3 E5 ^
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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