Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 x! I5 F& k4 D- @$ ^  
4 ?+ h' \* P9 o" `  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: . x- _1 l, G. S% f- q- U: i* p, n
   . o3 q, ^/ J0 X$ e: J/ d1 o
  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
* w$ M0 h8 [. f5 `# \" q6 n  
$ o4 d" [$ M; O: P; O  Options: ' u/ j  v- q; Q* k# Z& y& X4 @
   5 u, O2 M9 ~1 }: `
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # q2 ?, L0 Y0 |0 k6 e& ?
  
+ A( I4 U- H5 U) [: k  不停的ping地方主机,直到你按下Control-C。
/ V: B2 k' M: T, ]2 r3 d   + |3 G( q! S& i3 l3 C' n6 `
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
; W  X4 D2 ]+ j1 |- V7 B4 @& Y     E% q+ q- o1 E& e* d
  -a Resolve addresses to hostnames.
6 O' @1 v/ ^6 I" L  
0 N( k8 o. K0 y, G; N$ s# L0 k4 H3 S  解析计算机NetBios名。 / l0 ^1 q  g1 O; w
   # \6 H. Z9 h( M) l' v3 k
  示例:C:\>ping -a 192.168.1.21   i" c# j) Q$ q6 S' }
   7 e7 e& L  [+ v' G
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
! A4 T; u. f0 |. v" d   + F* ^# r/ P4 O% w% \# P( q: L
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , Y) W5 X1 F, l
  
. F$ N8 @9 v( X! @  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / M1 l  i: r7 Q0 {2 K. S" d( K
   5 ?7 p6 j. F( n# b! C" K
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% ?* l* `! M/ ~/ ]. z6 D3 K  Y/ g2 \7 C7 T+ F: S8 w3 [( ~
  
$ Y  t2 k+ s% k- g  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 I9 \$ _( ~9 ?& Z" W! m, ]4 s
  
; Z5 a+ F# t0 {4 @( v' N3 t  Ping statistics for 192.168.1.21:
4 J4 L- a& h$ [: W6 ?+ w1 r   6 X1 L$ F2 a( G6 U3 b
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
1 d! p+ o% p# }  
  Z+ [! }0 n: `/ i: |" V3 B  Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 }$ D& D' }7 w$ c- q0 T/ G2 W$ V3 j
  
7 i" u* g4 _+ V: O8 C2 t$ Y  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。   J9 |! Y4 Y3 a( e9 U
   % Z5 l/ @* e- d* [6 J' u! G1 k
  -n count Number of echo requests to send. 4 x( i7 o/ k3 l/ V7 M6 A" b" U( ]
  
) m- z4 K. @$ w4 |2 x: R  发送count指定的Echo数据包数。 & m8 A& F2 E$ {- }
   2 L* x' j' Q- P' `5 \1 S
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
: D8 ?( o( Y; U7 P( M  
4 X/ r% Z: h2 ]  C:\>ping -n 50 202.103.96.68 1 z% O5 c  z7 j3 |5 i( [
   . o. K& I% Z; V- S2 W* X# ?
  Pinging 202.103.96.68 with 32 bytes of data:
& R; [  ~! H; m, o; ^2 _  
4 A8 |' `) r6 V/ S/ w  Z  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. ^/ s, _5 R* [7 s! O" N   % m: d! |& a+ `" g5 W
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ ]% h% Q; D# a, l( {1 W- F5 ^     g3 W. Q. W0 E5 y
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' r* h$ ~  E0 ^3 _! w( f" M( D/ v2 `
   2 ?; T4 U/ |; s" X$ l0 m6 p* T
  Request timed out.
, L% f  c( e2 Q# N; J  
' S7 p4 W' U! q. f2 {/ m  ……………… 8 w( V+ O& N. w, @) d- _) M, b: {
   2 K$ ?, j6 Y# S( c3 J4 e5 X
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 X' u7 `  Q2 |  G   6 R/ \; S! o  E2 H" K9 |  n
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 L7 R, `1 x, {% P% \: E* z  
& [. G& T! I0 ~0 K3 t  Ping statistics for 202.103.96.68: " i3 |4 J: J9 S
   9 i5 \  X; g  u4 a) x. x
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 B2 J+ t9 ~* |! L) D, r& D: G6 ]  
- k, z8 {5 p/ B3 o  Minimum = 40ms, Maximum = 51ms, Average = 46ms
( s) p3 V9 Y9 o2 M' i   3 o0 |2 A4 s- S
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
5 R5 w8 E7 E( X! b, m) u( \/ p   0 \1 F, w. N# J
  -l size Send buffer size. 5 ^/ f+ A1 S. P* g
  
) u& A$ N1 `5 \- {2 Y  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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