Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
- a0 U3 \4 Y& C9 T. j  
, D# p; S% N8 {: G) q# _& e  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. H7 d" g6 A  A) i4 J   5 o' w& s) x: ]9 T' [# v: x
  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
4 i& p% w6 s3 I! n' o  
: x& _0 {$ c) I. H( r  Options: 9 B7 P0 W, p+ g1 A# |! U7 J
   % B# D! }9 x/ y
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 3 W# E- a9 E/ M+ v& k6 E
   1 B5 U9 F7 ~8 _. j  u7 |4 K
  不停的ping地方主机,直到你按下Control-C。 6 d5 r# t; D9 ]1 `
   6 V- [) r7 d+ O/ m
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : I  f: ~+ }: ^  J6 ^
  
: X# F4 n2 F6 l+ X* M% F  -a Resolve addresses to hostnames.
) ?  N/ v8 z& }( R" R1 ], r5 r   9 Q7 O- w; T6 p" ^; n: h
  解析计算机NetBios名。
+ y; v5 u2 |! v* C8 b, g   $ b3 g% G! A1 Z8 T0 {
  示例:C:\>ping -a 192.168.1.21
! Y3 }5 N- V( p" J: D3 L   1 R/ D2 s1 ?) q7 v( W9 s
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: / v' P7 i& C& Y$ G8 K6 P2 S
   9 u$ d% q. A7 [& L
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & m( u+ r/ e: N7 D$ i% A" ]
   1 |, A4 Z2 d7 K) `; M
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 X6 M/ T% q, L$ ]( G7 X$ b6 O   ( w) Q& `# x' l+ x( m% _3 A
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ Y/ V  X& n  d9 `& i6 z  I. C* N+ @
% L* F% @0 ], A5 [   5 ~. q( S) ]5 B1 {' y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" ]6 j  z2 s& F+ z! r  
- _$ p! V! s% h! ~! R! c% m  Ping statistics for 192.168.1.21:
4 o2 `! d) X! b5 l   * f0 ?- R0 `. y/ @
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 \3 B0 v) z) ^! y; O
  
0 c; b: z- O8 j' X& Q8 b/ c9 C7 j4 @  Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 B; G- N; a) `  
, V3 E9 w) @" E0 t  n1 |" P! X  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 A! |$ k. u0 {2 ~$ J$ }( L. ~: J+ U   " }$ y. \2 B+ E, B! _' f% k; A- W
  -n count Number of echo requests to send. % Z. a$ F+ |! o! A( V3 p# H
   ) j  ]! ]. t( \) T1 m* j$ s4 Y( B5 [
  发送count指定的Echo数据包数。
: E+ [& r; J4 g+ q4 b7 O   % H' G  \! Z$ b
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
; {4 }- f& B, I& ^9 ?  
9 F+ z7 ^, D% |# R; z  C:\>ping -n 50 202.103.96.68 2 H" H; o9 W! F9 u4 i4 r) |2 U
   9 {4 j% k! l3 g! G( X! U
  Pinging 202.103.96.68 with 32 bytes of data: + R) O( w" S& Q9 d9 w
  
" J7 _* x% y5 R$ |7 B& I  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # [0 X1 i& ~( n; z; Q& m4 y
  
( Z5 L# U  p/ b3 n; N  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' s8 j6 v3 `2 o; t+ {& s   / ^4 C4 G  j: f
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % f9 W' q- s  T* e* a% I
  
' l+ E, i! ~9 `' |/ I( B% U  Request timed out. & S' ]. m& F( o2 ]* w1 K
  
2 l5 j7 r9 U0 S( w  ………………
0 {1 ~$ U# {( s; _& P   . t0 T  n/ Z3 }8 W
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , ]+ _! C4 ?) w6 j) A& C
   $ g- k6 B) w* J1 B: k
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' O  i+ z& P, Z* D- g. z
  
- {* ~+ C% }2 _  g  Ping statistics for 202.103.96.68: 0 Z  v% d/ W% U
  
/ a2 }4 S5 T, ?3 R; J2 h9 n  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 7 K1 C  Q2 A. B
  
" H2 L8 \; U9 b/ g! r' P+ L  Minimum = 40ms, Maximum = 51ms, Average = 46ms
) p1 {; j, y3 n5 j1 ^# a   2 l* M# d8 \9 J; R
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 @3 s; O: Z& s2 {7 c; l  K
  
' X: G4 |, y( e* B  -l size Send buffer size.
  z; L( m1 x# M) V' b  
, v, ~, F  Z, }5 ^) C- r  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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