Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 , ]) _7 P" u7 ^$ F
   / w: V/ N4 m, Y+ v( u# b4 A1 r4 ^
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
% L' K: G  b' V7 N& c& A: {5 @8 G; }  
9 C5 Z: f7 v; \0 `3 Y9 _: j7 M  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 ) p5 R' Y" C: z& ?( f2 e
   ! x5 @) U1 r" ]( ?- W
  Options:
; |1 ?1 ]& t+ \7 D6 F7 {$ q0 o   + {0 D$ G5 P# u( m# B7 e0 y: ?
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 6 l% l: L% E! Z7 ^1 G  A; ~
  
. @/ @8 x" ?! v' ^- C: Y  不停的ping地方主机,直到你按下Control-C。
1 ~# J. z# F& A/ T$ q  X  
4 ~( Q1 e, [7 z1 \- r5 A4 n9 t  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( ^4 u, o2 I4 W3 l" b
   : s6 Y& h: p+ D( M3 y
  -a Resolve addresses to hostnames.
- v, U$ ], A7 ^' k! j  
1 a! P" ?/ l1 ?( F+ B  解析计算机NetBios名。
& G/ G. p8 \; R: M! s9 Y2 d  
/ j) f" |; e( P6 i3 V2 d  示例:C:\>ping -a 192.168.1.21   w5 P' z8 ~3 m3 A
   # X- w; K" i6 o  t: i
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
6 Z5 Z! E; b: e" ^  K  
; Z/ d1 J' Z: k1 m, W5 i. X8 R  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254   {9 i: Q/ N( h3 b! |4 T+ i, O- w$ C
   . n+ a7 r) N/ F- t6 S& r
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 Z) o# M5 O3 m' {- {/ e9 T8 U
  
! k0 s$ y6 v+ s1 Q3 y/ D/ ?  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; g7 Q' I" R, c9 E) K

7 S( c9 ^! V7 T  P4 a# a8 p3 M0 }  
! u6 ^6 P- x, }$ \4 F8 D+ a: V  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& B: Y( S$ i, s( J) x: V0 J  
  Z( }9 ?5 U. s9 V) [8 {: X  Ping statistics for 192.168.1.21: : q, Z6 H6 Y5 K4 i
   9 R0 P6 H6 l- N1 s* S
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# G9 _: i( x9 c" T9 t   % H8 }% ~% r% I; f% m5 H
  Minimum = 0ms, Maximum = 0ms, Average = 0ms # H; e7 ?1 `) v' q% m+ F
  
$ y4 Y/ g5 @" T7 A; Y' c) N  Z  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ D# I# E3 e* n2 Q* Q) S3 t
   , r6 I. v; R! g1 K
  -n count Number of echo requests to send. 8 L, K7 u# D6 ]) J+ t
   . E" e1 w2 }/ V6 T: H
  发送count指定的Echo数据包数。 0 L/ b; H  O% @) n+ f
   # b4 e: h" }' {, a  B1 m. n3 h$ f
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: : S) M7 }) R3 h' D/ ^" j9 \
  
6 b6 G; Z; `# D  k  C:\>ping -n 50 202.103.96.68 9 F0 u4 n3 ]# X6 x3 i+ G/ W2 H
  
3 J' h7 ]- V9 Z; ]3 [* Y/ ^  Pinging 202.103.96.68 with 32 bytes of data:
$ |; p6 V2 Q4 F8 L5 Q  
% Y" `2 X6 D* \5 l; _  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( F% ~* \8 A* t( V. A3 o0 P5 a7 W  B   : o% R+ b6 k& A- Q, {3 E
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & ], T+ p) h; h: m+ i
  
" c/ J( ]4 Q. b- }/ z6 N# Q4 `  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & w& h/ Q5 T4 w! I
  
9 a# K- [; g% f1 I  Request timed out. - u; e+ `. N  H2 h+ a4 S
  
" N: V) s! E3 c6 o. s  ………………
9 }+ Q$ ^+ p# d0 |6 P) E; i4 s  
* l5 ]0 d+ s' S' b& x  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ O! Q- A, }+ j5 T  
# Z. I! r8 U: Y. g# g& k- @6 B  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' |% C( j! c- w# ~  
. M! c" {6 g: H8 D  Ping statistics for 202.103.96.68: + X9 x3 m) }0 B8 i6 k8 U
  
0 _) `& C5 @# ^5 R& ?8 d8 U  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & j# P5 N% R) x, Q" `
  
1 H6 N4 P- g, y; D/ Z/ {+ ]8 d* l+ ~  Minimum = 40ms, Maximum = 51ms, Average = 46ms . y% @) c8 j; t
   ) F+ ~. D, X$ w% F# t" B# L
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 y8 A+ u4 K- |& z  G! r$ b' }) `
  
  ?- L8 E% `6 x8 `5 H2 G  -l size Send buffer size.
# ~8 l+ o  x1 p2 t/ ^/ I- h   & ^# e$ R! x; F4 i
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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