Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。   Q4 \& {+ Q4 w# W! [
  
5 a, N0 q* Z0 i  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
+ R( X- u) ~: f# H8 T   ! F* m, A! K. z: \% q: S
  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 9 ?4 R0 p* ^' E/ ]$ k
   8 `/ h- P# `0 T# L) m
  Options:
; Z) M! ]; s9 m) }7 p. m  
" j0 _1 X( H. }" X6 `  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
, v) v8 L+ V* e/ `4 O& b  
' K: O. u9 }$ z# |  不停的ping地方主机,直到你按下Control-C。
0 l. e$ b+ e& Y' E4 j  
; e1 C+ q# V# f. M. T( i" R5 U' n5 T  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 H% _+ [9 [# R7 f, V. x1 K; \  
+ |" V# n7 N) E2 u2 {% I+ H  -a Resolve addresses to hostnames.
" J# }1 D: f  i( q& \6 u$ }- K   % e6 X* `, g6 t4 y9 V5 c/ p0 C
  解析计算机NetBios名。 + {+ i7 E$ ~5 S
  
4 e1 l' Y2 o3 R. v7 p- x+ |  示例:C:\>ping -a 192.168.1.21   U% n) J1 |/ A: Z5 S! H
   - X" Q3 _! b2 t! e% w' x
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: / U3 `/ _& i" @2 u# Z* y6 q2 r
  
6 e* j9 t# q0 p+ d  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 o9 T/ K" [- K) t2 T* q. @. H  
: A# }0 ?5 W+ ~2 k  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254   m) `" ^* m9 |1 w& S* ]/ Q' |
   . S1 M% }# P, p# Q6 C, g0 D. h
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" T3 i/ H( Q) \+ i/ t' O% ^  Z. f6 W: g& {; L- y3 h# {
   ) j0 @# K6 X2 K+ k7 q  W' [5 r' U
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * C+ H5 n$ p! j, Y* l; W6 H: v- i& m, m
  
) ^; E7 P& ~) p  Ping statistics for 192.168.1.21: ( Y9 L- K5 a# h3 U& J
  
& g4 [: c2 u& H/ @  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % g& ?0 L. d% i6 n; h* b
  
7 W, K/ W0 S: a5 ^& _3 B! ]  Minimum = 0ms, Maximum = 0ms, Average = 0ms , u, t; Z, O" R6 ]6 y
   " z7 B( b! Q+ V' M& s3 v
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ ?7 `& m3 ~+ N$ l0 U
   $ V6 Y# b1 L2 p0 j3 ?' j, U! `
  -n count Number of echo requests to send. , A& ~0 T6 k. F! _+ p7 `) W5 ?/ E
   ! i, B7 m& M/ O5 T1 D3 C6 g& L1 V
  发送count指定的Echo数据包数。
$ e! [: o0 ?: L! e" B( T" x  
$ _% X# H. i" P% I+ v  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
/ y6 N6 U3 d( [% h4 q  
: n: I9 v: H- A4 s  C:\>ping -n 50 202.103.96.68
# }3 j3 I# S* d  
  s5 p  j7 r9 w0 S. S2 t  Pinging 202.103.96.68 with 32 bytes of data: ! T" J1 X6 ~5 j; p. f( i
  
2 Z% x! E& l9 R2 @( y- d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: c" O: }4 [: b8 a. u' B   ' v. m8 c( l; F& ?8 t0 |% {( V
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! U6 j- Z0 p" u& U$ m8 F$ {  z  
) ~4 H3 q; a1 S" Q  q  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# H8 J5 ]7 n- J" h8 _' \8 F   $ H0 a) q+ @7 z% Y/ a+ f
  Request timed out.
8 t8 s1 o. t3 U, C8 _9 c   2 _! g% ]1 y5 N3 H3 [  l
  ………………
! W- G- R" j# B; e6 _0 l  
8 |3 {  {( O/ M( ]8 E  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; h  D9 A+ u4 W* d9 y  
! ]3 q- x) i" `! g: ~  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 p- W3 A( L) Q; Q& \# ?
   4 \: @+ O- a. ]
  Ping statistics for 202.103.96.68:
  w9 x7 b) p1 J' R+ x3 d& z3 a# t, F  
4 d& S( c+ K: z0 n6 P  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 Y, k  t% O5 q4 @/ |
  
! Z  R4 ], a; U( q, T% i5 o  Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 u/ `  y8 W* ]2 d' _$ I2 C   5 h$ M/ k1 I9 l' a3 ^
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; Y, W9 K; y5 `' p0 K1 r/ u
   " _/ h6 C' }/ E$ u! a* I0 e
  -l size Send buffer size.
# C( O- J7 A7 D, l1 l$ p* V   $ o; k2 L8 ?+ Q! T+ j
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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