Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 q0 S' q+ D+ f6 h: v2 ]- c  
% T9 C% R, U, F* |3 H" b  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" f+ x! W4 m! t! F5 Z/ r  i& l   ) n* V9 A( b  t: J4 K0 z( i. 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 + u( K8 |) g. y4 J/ a& P
  
. U) b% ^2 ?7 `/ E" c( A9 n2 I  Options:   }$ w) f' `) Z, z8 e
   4 H! E, m& ~! O. A' m% T# u
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) X8 v1 w2 ]4 `8 Z( t
   ( J' H# ~5 {! S. }& R8 j0 [
  不停的ping地方主机,直到你按下Control-C。
* F( a3 n( x% ?. S  n     O8 D+ }9 F6 k
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 " Q: E4 E( }$ |. ]1 B! e' {# l, o2 Q
  
, ~, h2 P1 A# A  -a Resolve addresses to hostnames.
  I$ j! ]# Q3 Z  
8 b: `' x3 ~9 S5 L* L2 k  解析计算机NetBios名。
$ x1 N4 I! K. V9 o   . Z; Z  H0 S) W/ h, d' j6 h
  示例:C:\>ping -a 192.168.1.21
8 _& Y. m+ F3 Z* ^5 P* O   ' V3 W, D3 o5 ^5 f- n
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
: L. Y7 l3 E3 L  
7 z+ _0 P, g5 i2 Z0 E) q  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 @! I/ u, z- U3 Y
  
, A% e  m8 D* K  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + @: {) [6 T+ J  s) D) u
  
% o! `+ Z9 g; O2 K6 }- v  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 C' G1 Y9 z2 \) W- X" g" A

* o' f, ]+ R/ M1 S! r" a" s( n, r   5 c5 H6 B3 U! I+ O2 H: y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' d1 h5 c' `# e0 u8 \3 c   ' ^- q# y2 u, h8 R% d! b! A
  Ping statistics for 192.168.1.21: - @' r2 X* z# l7 y  q2 E" K* E# l
   , g4 z8 }* @4 K
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + I0 e' I( r4 {: d! y0 j0 s
   ) K, {2 C! ~& h6 |/ a
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ @- k$ s8 C5 T3 [' y; j: l; V  {, ^   : R* o  W4 D; b# A5 b
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 l% K& z8 O, W( Q% B( |   - c7 m- b6 j) |
  -n count Number of echo requests to send.
' s# c  \- z# z2 ]$ w( S8 @, y  
7 k/ ^( V5 i4 `' f# U$ A  发送count指定的Echo数据包数。 - x  a. q: E; `$ N$ r9 V8 r
   9 H& E+ z' N* ?2 h1 o5 S7 m9 R- E, k
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
4 v' f& l  W+ x  
+ n  j5 e* ?- @+ D2 F8 a/ w1 U* D2 t  C:\>ping -n 50 202.103.96.68 $ w6 B7 z- j  a! a
  
6 Q9 B" B. i& b) a' m# }  Pinging 202.103.96.68 with 32 bytes of data:
' C6 s; m/ j8 a5 M' v  
# H8 L7 t. l$ X. k: W  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 q1 ?' P7 w0 Z/ q3 C" C( E
  
0 `) d! O1 _  o. Q# j- t. c* q/ [  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- n  X, f3 Q, l& ~  
9 m5 w; P9 \0 k  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! E, c) r; k" }# @' w
   ) Q6 q2 j; O  {# |0 B
  Request timed out.
" e5 p( Z5 C- [$ W  
9 L( S7 n" |- T9 j3 E  ………………   I: q# i: E# k* l+ Z1 Z
  
( T  u9 j2 v# w+ @1 f1 t  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * F: m. r0 P& S9 ^2 f& k" C
  
, M; p# v+ {9 ~! `7 e  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ h+ P! q5 Y$ U: m8 y2 O* G
   ' ?% p% t9 Z5 L2 f1 \
  Ping statistics for 202.103.96.68: 2 P( G4 J4 i  N
   ! T3 [  c# A/ `7 r& \4 r/ }* f
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # J& m1 b; T4 i0 \+ U
   ( g  u# B8 Z, }6 A0 M
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ ^) T& O2 X( N$ {* M   ( a6 ]9 O- Y% r
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
! N& v) `+ W0 j8 y   3 p! N) x: G' \% F
  -l size Send buffer size. 3 P5 q( Z0 `& d) u% z. I0 m4 R
  
3 C6 o6 X  Q2 M; p7 p5 W  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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