Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ' e: I' m: y  A+ U2 `0 L* J
   ( f; ?6 d7 O# L; ~
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( S% M3 }# H; M6 E/ j, D  
. k4 G& \0 N9 f  x+ c, [6 {  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
# ^$ ?3 L  W, h" ]0 S6 ]  
% M: z1 }: n4 i' p% z% P! w$ H  Options:
* e0 O9 b! L: o   / C  K& u: v, i4 ~# Q" [% D: F8 l
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% W1 r1 E: ^1 g+ j/ y   " i2 t) u+ b1 ^* o! S" E
  不停的ping地方主机,直到你按下Control-C。
% \- \5 a: B7 g2 ?  o   ; r1 p$ g& _% ^, K8 _- m7 S
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 6 r& K& h. O4 J5 I: x
   ; e$ d! G) z/ o
  -a Resolve addresses to hostnames.
9 ~- d. P, ?$ c; D  
# o# ?/ b; Y5 Q1 T0 {$ \! H+ s+ q  解析计算机NetBios名。
( g4 P' r4 z6 R0 E$ r, D   * Y/ \% ^5 h" ^8 P  W& j) T% \
  示例:C:\>ping -a 192.168.1.21
  {& P( s% f5 Z7 Z   $ R/ ?# o) a$ k
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
7 P9 L/ J% E6 |: H" w! b  
) L8 s2 m. Z1 x6 }* s- Q% H  Y  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ {9 ~% j2 w. N: Z, m% G! v+ N+ A  
" w, c! O  u( v7 |6 C  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * v/ X- j1 z5 q5 l! ]. P6 u! n
  
% @/ n% I$ U7 B5 \6 _  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254   q  C4 R) ~% H$ B" h

1 A( n4 F' \6 U& ]/ l. c! ?   . \, K8 e9 {0 x: m: K, I
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' {: O# Y& ?2 ]; a   / m- R& y. M- b8 V& p& u+ a, D% C
  Ping statistics for 192.168.1.21: + O) A! f' p1 ~( o- M
  
" i5 a  P/ g* V5 y! X9 Q1 y  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 3 c& f- S6 |! D: q  ~# P8 P
   2 A& j: I$ n: b9 t( ?% c9 |
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 y3 c- ]- D8 ?- }0 P5 h  
; U1 e  f: I$ ?  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 V; c  `% E7 V; E" w5 w
  
( V& ?9 |$ W1 D6 o* a8 l6 j8 e  -n count Number of echo requests to send. % }! c0 u4 O& `1 l
  
: f' k5 o  a( d7 z, X* V  发送count指定的Echo数据包数。 ! ~3 V0 C* D; Z
  
; [$ r8 f- ?9 N- j# }  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! v  R/ ~' ^0 `( F: W  
) K1 Y4 }4 c( i5 }  C:\>ping -n 50 202.103.96.68 # u5 e: v$ Q' g- ?3 Z
  
) R, W) J6 w* [; k  Pinging 202.103.96.68 with 32 bytes of data:
1 g; j; e* i/ w) [   - B" E( m) B* e8 v/ e3 z
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 I( U1 l& a' t$ {/ {! Z  
% b  n$ ]4 F$ ]9 t  [  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ I! \4 O4 M, H/ w8 n$ H0 f  
) N0 X8 C2 u& v$ x* S  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; u$ D9 ?6 d- a+ G
  
- ~( Z) G- J& \, S  Request timed out.
4 V, {. ~8 s" [6 ]; A   $ X2 f; Z3 f& t1 B) \3 b; J
  ……………… , K( U7 n  E5 d1 v4 ~: I3 e
   ; l7 S' b8 W) l$ T. U1 x
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! {7 W8 {! t% O7 [
  
. u' l7 k# s1 u* \! X, _8 x  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + ]9 F' C: I. s' Y
   & N, t3 x3 G* p8 H3 m# K6 ]2 ^5 J- _
  Ping statistics for 202.103.96.68:
, n" v5 M& ?+ C' ~8 r# _( t0 X  
  i6 g+ @- Q% t1 k, |0 _  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
  [* j9 r6 n) x  o0 f9 W# @7 ]) L) b  
; R$ W! ]4 R" r  Minimum = 40ms, Maximum = 51ms, Average = 46ms ) T" l2 \, U  Z
     o7 T1 r$ v6 b; c
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 4 V" Q: g. ~7 U0 g6 w
   3 A9 W9 |. ^, u9 N5 y- D
  -l size Send buffer size.
# f  y0 c/ r+ b3 m" ~5 a: j, ~- ?  
$ z; p! b# U3 S$ S' m  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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