Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 6 C+ t+ |. J: l# d7 `# ~* Y
  
$ D1 l$ L! j1 I& d) H7 ]  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
; |8 L; ?! I* w/ W5 Y0 d% u: U: g   % F7 }4 ~/ |$ q4 P, D/ H. O
  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 - \% {4 t. [; X' s, k% Z( x
  
& `5 v0 P$ H# d' s- U0 x0 |$ [  Options:
7 Y8 ^, V2 D8 s3 v, N# w' m9 K  y   , T7 b& u0 i  _3 t) ^
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
6 ?" F& ]$ P0 T  g8 c% K3 h4 |/ t  
2 c) m$ z) Q5 ]( w2 U, T  不停的ping地方主机,直到你按下Control-C。
1 Q) q1 r& X3 }; K   & w, C8 k" l8 Z& p: B7 i- e0 K( i
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . r2 w7 m% B7 |  c
  
7 r, E; A( r$ x: B# p. c, j  -a Resolve addresses to hostnames.
% r$ X: B9 E& J" C/ t  
* _! _* q& c  X: p  解析计算机NetBios名。 - N1 {: ~2 u2 y$ u( d% E7 a
  
. W  q+ O$ r1 J4 ]  示例:C:\>ping -a 192.168.1.21
1 w9 h8 M4 l8 q8 B" r  
$ t3 s5 d& ^9 b  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * j$ a2 p7 Q" D4 c/ T. o; q/ W
   9 H5 o4 R$ a4 B; A8 m" l2 y7 f5 d
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ ^4 ?( j( ^/ R1 N& ~& H5 e9 {& W
   ' q$ m- X& n1 U* ^) v5 ~, D
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- _5 q+ ^& H- [' `) O  
. Q# y( n8 t: e" c" \  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 a) X, R& w3 `7 {7 e  Q$ G

9 E, P! ]( r  h  
) l3 I: W- C; |& _, D" a  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ s5 O& v$ X8 ~8 c% |   : Y- B- a' W' J3 c
  Ping statistics for 192.168.1.21: / X$ e1 Q1 D" v7 x) [9 e! G# T
     a3 V: m" h5 f9 b0 k
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
! z# B# d  z- ]0 J# s) I& b& x   " o, F: L1 T9 |$ x# _# i
  Minimum = 0ms, Maximum = 0ms, Average = 0ms % D- b( w  ]. h% n2 q
  
# T, T2 A7 e8 t9 Z, U  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, e8 S2 u6 X: q6 g4 e) X- g  
4 ^1 ?& G, M- ]# w1 b  -n count Number of echo requests to send. ) N$ m" B, y5 W, k
  
; M, [+ H- x' ~  发送count指定的Echo数据包数。 $ D9 R  \3 M2 E/ I  t
   & {) X! X$ [; x+ w# D" ?
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
# i  N2 K) `0 T; {, |5 B) O  
% Q6 M+ F, t: ?1 Y  C:\>ping -n 50 202.103.96.68
% I3 I4 u' Z2 b1 K7 A# h% H   % J6 ]9 N8 n, w: o
  Pinging 202.103.96.68 with 32 bytes of data:
* z3 V2 i; V+ e, n5 a  
/ @$ e$ E" H! U- _" w. I  Z+ i  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' _5 o9 B. t" I  V, s! g4 r
   0 }. Q  M! k) m& M2 M
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " W, p1 |- C6 n" G% m" s
   " m8 P1 [; q8 U' L& N+ ?  y$ L
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & Q7 |2 Y1 C1 I/ r3 G
   ( o3 \' X, J; |9 r1 z5 w
  Request timed out. , j2 W$ N: u+ m& _( A3 g/ J+ M9 ^- a
   2 x* s- [; w5 R( s
  ………………
, q: ]8 Q" b% l% `& t   8 R% i5 x0 e8 a8 v2 z. h
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ v4 O7 n0 ^$ j  K- K   1 T' \3 I& d! k. X
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - a& p8 B) r% ]" X* }4 N
   $ B' U# n5 S/ m
  Ping statistics for 202.103.96.68: ' y% y8 c7 p+ w% e
   4 F  G5 b0 d& E0 T& Q
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 g, W" U* a. S$ ~5 i
  
9 F; M9 A" x4 @/ |9 U1 a9 l3 ?  Minimum = 40ms, Maximum = 51ms, Average = 46ms % M- r5 x2 _2 Y8 ~* |# @
  
( d9 ^5 p2 r) L# G  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 . Y8 h7 `* p/ S$ f, H/ ~
   ! G( q8 W) l9 ?) W
  -l size Send buffer size. 2 v9 C( w# N: o
   ! Q6 A; n( i7 j& @1 t
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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