Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + I3 E1 E/ A' M, F5 m/ a6 \7 ^
  
4 @9 _1 l+ ?3 h1 w* p# @, |  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 O/ E; e* W7 i; {2 b0 g
  
9 ~7 N5 w& W% |# _  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 g+ a2 ^/ G! W/ ?$ a: `" N5 \+ G* w5 I
  
9 s  ]+ {$ `" E5 p" r  Options:
) _% B+ V/ C& p   ) Q, D0 @" }- ?4 t8 ?9 t& L
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. + S0 S. J0 g- A
  
% R8 e* x' p% S+ D: e2 p  不停的ping地方主机,直到你按下Control-C。
) s* ]' h- K6 L7 s7 v* \. S  
' i& B' j: ]0 a$ [* `; F6 m4 _* b  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) @: L# X- ^: D0 c" b' N# z2 Y" y+ @   0 m  H+ E9 D' }- R8 z5 Y
  -a Resolve addresses to hostnames. 3 F) s. W) j$ _2 ~
   ; G" V' r# J  E- ~$ ]4 H
  解析计算机NetBios名。
. P' c+ N& Y: t3 b5 I  
1 N+ K4 B! v- z* J, ~! R. i  示例:C:\>ping -a 192.168.1.21 % d3 h8 y  E( V
  
  x& l$ b0 k9 e' I3 J6 b4 G  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 B" Z' F* [2 [) n$ B
  
$ i9 O. U/ G- p3 g  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 Y' p5 H, g# C8 T* p
   0 |( a3 ]7 ?* V$ ~3 h1 c
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 r8 ]$ S0 e/ C7 ^0 ?
   5 j) ~& A- y8 d% V3 ^. @
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 h! \  |$ c. n' F3 l; l5 W  r: _# `
   $ Y) Y3 ^% ]. C8 r  @) |
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* @8 B, ?- W: ?: t8 x9 ~. {1 e7 K   ; X8 b8 C5 c. E+ H! d% V4 r
  Ping statistics for 192.168.1.21: # w. j, I5 e% L4 Q6 p1 M
   ; D* e( P9 S6 m+ o& c) b$ Z
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
' T7 z; y2 i2 ?7 x   $ j+ T  E$ w! s& @4 C
  Minimum = 0ms, Maximum = 0ms, Average = 0ms : t; J, A6 ]' X
   / l1 l4 u6 B6 {3 J6 e6 g4 M1 v% ?. J' F
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 , S4 u0 h& o: x% T
   7 ^# N/ U7 f6 @) R* M8 @
  -n count Number of echo requests to send. 7 J0 ~3 |7 |- \+ }
   . r" l2 A% @( Q' ~4 Z
  发送count指定的Echo数据包数。
  a& y4 i# B, h, g, }4 B  
+ O+ Z. F7 _) H: n; F  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- i- r6 Q' [4 p) w, i  
0 ^1 @$ C) y* }& {  C:\>ping -n 50 202.103.96.68 6 u; }% b* J5 b
   % k% [' w: K* b$ H
  Pinging 202.103.96.68 with 32 bytes of data:
4 @9 ?( u, q5 W* o1 `1 o   . _5 G* ^( v& l1 y1 \1 f- X
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 T; ?4 {. Y" Z8 f) g  
, x- G  n3 o  u, K: D& a  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # {& h  ~0 u: d, _- Y. M. D
   % I5 @8 K! t2 \5 K9 Y* t! R: l- k
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ }4 k; i9 `+ y* u; j# c   2 k; d) X0 E  C
  Request timed out.
. n2 n6 I0 ~: \+ j; J* M+ |   " Z: O3 r2 ?: ~% ~# x9 J# T
  ………………
# q9 T+ q, ~) ^) n  k/ E- k8 C   0 u3 ^. y6 d: C. Y
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. r5 T& T. Z$ z2 K  
: U  |5 q6 G2 X" P7 ]9 W  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - Q: P2 I/ Z" }& ]2 t# @+ M" \7 ?
  
1 q0 D& c/ a$ B. u/ k  Ping statistics for 202.103.96.68: 4 M, P4 O1 K& }0 @; T+ ^7 D
   ; ]' |' j, e8 Q& z+ T# k# j
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 8 e3 D$ _/ m* w0 v" E$ k7 p
  
" |+ K) u5 g5 B) _. B  Minimum = 40ms, Maximum = 51ms, Average = 46ms
8 z8 }- q- u& {  
. F- @/ [7 d  X5 g  p" R  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& N9 a' s! G- t. _# I  
* n# y, a  i: b' ~  -l size Send buffer size. * ]) J1 w$ S: F% V  d
  
. `3 `8 t  {  |  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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