Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! {2 W0 J: F; T4 j4 U+ l0 ~
   7 z5 h$ d. S+ b9 S! @
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
: k, F  v$ P; m3 c   ( ~9 d9 |" U- {; e% t
  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
' m2 @5 {7 S' l, U3 k+ Z# H  
. O+ g% `9 V3 p/ C) R8 d  Options:
, q. l8 K5 P/ _4 s- C& @   3 L* q9 b" ], v8 d
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
  ^1 H% W  |5 z( c   6 }1 u6 Y. x  k- q
  不停的ping地方主机,直到你按下Control-C。 : o9 W3 G& l$ U5 b; `7 D6 H. R
  
4 g; q! R0 u# ~0 o' @0 X  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
+ u. a, V' W; s1 y" b/ u1 }3 ?   / {  W$ I. \% ]) b
  -a Resolve addresses to hostnames.
+ d0 k( }, Q* w   & ~% H5 r6 Q/ T( Q- I
  解析计算机NetBios名。 : L1 C4 {7 T' P3 [* i! U
  
* O9 j% a& r6 s( R* G. A/ F9 N  示例:C:\>ping -a 192.168.1.21   W, \+ P. t6 H8 i, h
   $ r5 A# k& H& z/ ]
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: + F! {+ ^! {/ _' v3 d* U. A1 M- w
  
9 y" j- j( W, j6 @  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ j& M% q* r& V/ A2 i/ n1 E  
  b  ~2 b3 ~9 B( W1 J  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : n3 O& Z- ^! M" T# a4 \) a3 j
  
" R1 i6 K1 j6 w" k" a7 Y( M) P8 a  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 F' a: ~6 z) \# ^8 p, G, R$ \4 p3 m- _

- s/ ]: z/ L/ Q, Z   : ~, D8 |$ S! o! D2 l
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 F3 C- }6 F; s, Q5 M3 _4 Z  S   % z, W2 a* Z2 ~4 N
  Ping statistics for 192.168.1.21:
: m. q9 T# e4 a* p, ]  
2 F$ ?/ w& l) H$ ]  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 G% X  O8 q* A; X. N, b/ I
   * @) T6 t+ |& J3 u
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
; Z- L. C# I+ p1 L: G9 M3 N  
# G, R3 _3 _) P1 q3 ]4 d  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ ]' C# P. }* X6 v! r+ _. ?/ `
   0 ^0 R0 s  ^( G7 ~: s
  -n count Number of echo requests to send.
" |5 V' A) j$ m; J# E   5 d" H. V4 g, T# m4 W
  发送count指定的Echo数据包数。 # C8 @% _5 x( ]8 n8 f
  
. c  y4 }; {  u% f5 R( |' X) P  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! m* d4 \+ G! [" H  d  
! e; p5 }' J$ O' `" @; _  C:\>ping -n 50 202.103.96.68 1 m- a' p  s) c. a& x1 d3 Z0 h
  
" X, R+ x6 D7 n* z" y$ h5 n: f  Pinging 202.103.96.68 with 32 bytes of data: . ~! F. ^& g* x7 U
   ( X& z, _$ y  B$ @& L3 ^7 F0 I
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" @4 X! a$ {$ \/ B   % N$ ?% B! d1 [$ X
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% N  l* w6 Z+ s) i   + T! l# i5 p+ B9 Z* r
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 D" }8 k  R5 b* c/ B- Z   # D+ M) ^) N+ r3 f5 E+ V) a
  Request timed out.   y- K- ^$ _& W' C0 D$ J$ m  n. G
   # d& @& R5 |1 L/ [
  ……………… 9 F/ z2 G8 K4 v& _0 d. G
     j0 @. t- u: T1 Q: A
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 ^$ h$ U5 _- ?- R2 u# {& \2 o( [   " ?; E5 W& a! y( A% s( j
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 @' G; A* j1 ]6 E+ {     `" t; p  i8 }
  Ping statistics for 202.103.96.68:
, S" G2 U" {0 ]/ R) N. N5 k3 I/ Y3 A   * Q2 s& m' O! f0 \7 _8 s: l: e$ {
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ! n! f( M& o8 M
  
6 p$ M9 N1 `* q2 |( ~% [9 s  _* K  Minimum = 40ms, Maximum = 51ms, Average = 46ms ! y( N& V* B- w: {$ w
   1 m  K5 O4 \: q$ U' V7 |, Y
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
! }0 l! S6 }& |+ _6 z  
, b) H5 R2 E7 \( ~0 G4 d/ R/ ~  -l size Send buffer size.
/ Y) P& Q7 N/ g! l# f9 Z% i  
8 f+ R$ J8 k4 ]' c% B/ K/ }  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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