Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, ~) X  n1 {! }' k; ?  g) Z7 o& o: I: D  
! W4 m+ n  B$ n$ k& }+ s' @! K  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
2 _' _1 D" B1 c5 C   ' D, r1 [( l. a" D$ d9 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 2 J9 ~) R2 d  u  s4 d
   1 G4 Z, ~  g* x: O
  Options:
: L9 G: s( l$ n/ }! o; d  
; Z: c5 l; @( T2 g: Y. s+ m3 Y  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
4 D* H, t. Y) I3 h# U. c4 _, h   9 G& T9 f: _+ m4 }4 P
  不停的ping地方主机,直到你按下Control-C。
/ w6 v8 c& K: X  
7 `# @+ Z4 p: m5 w4 W$ S  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
/ e0 Q4 o+ g' E/ K( N0 h% f) V  
" I- X3 K, |* t( D  -a Resolve addresses to hostnames. ) H9 `/ R% Q$ s+ r/ i
  
- n1 D; ?) s, u* c  解析计算机NetBios名。
; F/ u* [% i3 e# `; c  
: ~2 Z1 g7 e) }- o" I  示例:C:\>ping -a 192.168.1.21 * g, L- o, S2 A& j- a0 Y, a
  
2 S) w8 F* n7 E7 d4 Y  a  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
  @/ S; E/ ?& D* H( U! f. V0 k   , j* j: r( Z$ J# z( e. ~
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 N2 H  [$ d- a& R7 G* _) i1 l   # `8 j/ F. A. P; Y! B/ T6 f( j
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ U% o- |8 ?% J   ) n' j5 \7 m) |% P
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( r% d9 y, |, [2 \# y
* |9 w- B! `4 W# u3 @# n; [  
: V( E( p1 ~& ]* U# ~0 p6 I  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / o7 U( g5 d5 S/ p" Z! `
  
% q% j" _  y7 O2 D6 N' ^3 G- {  Ping statistics for 192.168.1.21:
. ]2 N; c5 I) ~$ c% H6 u* B9 |3 R   , a3 L  O3 \3 X5 \, [7 `
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 U' B4 [& Z, V7 E: V/ b' U& y) s+ j
  
+ F8 v  [8 p2 H% E0 l2 q  Minimum = 0ms, Maximum = 0ms, Average = 0ms
# `+ w% z* _% h' q: P0 t1 A   1 @9 O; ]6 t8 g+ J3 Q* R
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
) Z! ^; x8 Y1 r2 L   9 [$ ]# s# }  i# p6 q1 B  z8 u0 P
  -n count Number of echo requests to send. / z2 D/ A$ S# ~
  
/ T: a6 x4 e& j' e* I  发送count指定的Echo数据包数。
' G* q0 F  B5 I& @0 p- r" `4 Q   ( ~  `' p" m6 x9 }2 ]8 X  L# S) l8 c
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) M2 w9 b7 u0 W6 a1 B
   3 a, B4 Z  h) m, a0 Q2 s: k7 Z
  C:\>ping -n 50 202.103.96.68 3 F1 i. s& ~+ N/ m+ P
  
) U1 A/ {% O+ T' {  Pinging 202.103.96.68 with 32 bytes of data:
+ m$ T2 |! |6 n+ |' y0 H2 X0 C# d   % l7 ?7 a) V2 k1 K, Y* o) w
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' @' ]* b& R  |/ a   9 @( x% O0 ^  s- c$ o8 F& F
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) c* w# J. P( ]. K; O/ S4 I  
! ^/ f: a. g7 h# ~  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 y- l$ q9 |+ ^0 x/ c" g+ s+ t. [+ S  
- q7 W$ w, Q) z, y1 E6 Y9 ?  Request timed out.
4 v" H' P7 q* E7 B4 X4 `$ P1 ~  
. Z5 C( E/ i) ^; V3 _0 `5 z  ……………… ; w) J9 G4 X/ ?
  
! K2 @  z! T2 o  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , r( r4 i9 \6 m. R( e
   ! |4 F1 }' i+ G+ Q- u0 R# O. Z5 x7 g
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 t1 y/ m, Y2 k( u7 W
   ! k" S8 q) f5 Z% Y, `, S
  Ping statistics for 202.103.96.68:
: e) R& R( j3 d( b   4 |( [5 z, r8 R. J- v+ w( Q
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , W  }0 c# L, c2 {  [
  
# I9 j: q5 G/ |* ~7 w8 q  Minimum = 40ms, Maximum = 51ms, Average = 46ms # g' z7 U, }' A; J- K
   ; }$ v5 G7 K, a9 ?; j
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 n/ U: e2 B$ |7 \$ x
     x/ x! o" @, @% {$ ~
  -l size Send buffer size. 7 a9 r# x1 x! T: z2 ?6 w" E
   . n3 O- _7 ^0 w
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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