Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 - Q9 Q+ N" u0 z: m, Q7 r
   ) e9 t: R0 K! c' B- k
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 y/ f6 ]+ \. Q, z   ' R+ q( K" a# h/ F) [! Y
  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
/ Q/ h$ K4 j  s1 o9 `& q* E5 F  
1 \) n( @" H. I  Options:
9 z5 b" o7 \% p) ^' I   % t+ g. g& @* k
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
: T' i  @8 B) f- {9 V0 J& G8 {   ( u) b9 M7 i+ y1 G. r
  不停的ping地方主机,直到你按下Control-C。 # b, n& ^& M" J: T: Z- ^
  
" Y, {- A9 G) A2 S. z6 l  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
0 c4 W+ j5 ]% j% c5 d  
, N. c8 F& b+ j1 L% K  -a Resolve addresses to hostnames. - w7 ?6 G5 b; s% l! q
  
0 _) Z+ g$ C2 ~  解析计算机NetBios名。 . N0 `( g, }# w( n, |
   # n/ C  W2 m" P, T/ K" [
  示例:C:\>ping -a 192.168.1.21 5 A, o$ F- p5 ^- X
  
3 ?3 Z$ W0 ^( D  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
+ [- U' `# R9 l( [  d  
4 }2 y0 k8 O: S8 P: ]  z  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 O* c5 `$ q8 M" q   . `* z. M! V7 T& V
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 i7 r. M4 x* d' D  
, }) |+ F7 e& T6 q  k+ X6 y  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : O6 O6 h+ q# S: e/ q9 y6 o+ O9 u

, P/ I2 K2 G% `7 k. p5 C   ' G! Q; ?/ ]6 F. X. [  ?& N
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: z1 P5 {4 v# I8 s; q' H9 p  
0 D# b" {  J! g* R2 x  Ping statistics for 192.168.1.21: 2 Y; }8 ~+ C( s5 N' X  d8 X9 q
   6 Z% j4 z1 G; w, e& S' I
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : Z, F+ b5 d2 z" h2 p  x( B: m
  
; j5 P! n& U2 H- q" j' a  Minimum = 0ms, Maximum = 0ms, Average = 0ms
  x0 v1 L- v9 K/ X3 V  
) W& [  D0 b$ u5 z& E; R$ Y9 R  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 ?* T$ d# r$ R8 ~7 ^; l
   9 X# U2 e% o  u! n$ a
  -n count Number of echo requests to send. % w6 {0 ?4 L/ B
  
; V; ]' f/ A3 ~, I0 C1 t  发送count指定的Echo数据包数。 4 o; {# r: h  Q8 r) n- s  P
   3 U! l0 B: h: E2 B5 D
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: / x* ?4 w2 f5 U7 U# C' {
  
: A3 }) l2 }2 `5 D  C:\>ping -n 50 202.103.96.68
1 v/ ?* _$ J0 x, O$ F  
4 s: j2 U' z1 E+ b3 n- o  Pinging 202.103.96.68 with 32 bytes of data:
3 f4 K/ L: O# ?" g+ @. o  
: c3 a) D* @+ s% Q1 a- p8 T. u. d0 V  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( U( D9 r& }+ x9 R& @   $ F; w7 ~8 e& |; s
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / y% t& i" S, m7 q1 Y
   + @3 _+ ~1 t- ~/ R  g
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; m& [- o+ Z& H& A
  
  [3 a, L1 ]- A* m1 N5 r  Request timed out.   T& P' h* Z5 R! o- O/ g' q
  
7 Z( Z: h! F* ^; @  ………………
# U4 |* W  G8 [0 }9 n+ ^3 K: P  
8 R$ ?3 @" o" w1 m2 Z( m  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + b6 [$ c8 d/ A, p
  
( Q; K7 N. m4 f9 k1 T  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& V: w+ p/ }! j5 U0 \; Z  
8 M. @+ O  S" X  n  Ping statistics for 202.103.96.68: / u  @5 |7 R" |* X( m8 D+ P% m
   " O  v# o/ ~8 c7 _
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
) a. _  N* j. N" r4 ~4 l. D2 _  
9 G! ~/ r% e$ q! Q& M2 {/ W8 P5 s  Minimum = 40ms, Maximum = 51ms, Average = 46ms , D) A% |7 G4 v* l; O9 s  \2 M  X
   - W8 K/ S$ N. c
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 B" F% P6 ]( v4 p
  
! `! T% [( x# B, w6 j9 z+ T6 A0 S  -l size Send buffer size.
& h+ V* U# H" o% Q. m4 Z, p  
3 o6 h0 m% z* `8 T5 p+ a3 m% ?' i+ g  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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