Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 0 p" [3 ~  M- I3 \# q
   7 w: p: s; r5 w0 u) y" i2 a
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& u- F" u5 S& l  j( p  
1 ]3 S5 l( t, t8 N/ Y  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
' ~5 K4 I- R2 K3 B0 s) O  L  
, ]8 _8 }; u) b# k  Options: * ~/ {0 A( \$ R+ t' }% n
  
( C0 P  D* N6 c  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
7 o% a# d' t4 V  
2 b% u6 O9 v9 n: m: q1 p  不停的ping地方主机,直到你按下Control-C。
4 z3 Z! y- _% r4 d& u3 h  
  [/ t5 J6 x0 i/ G% U: B3 {) E/ l  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. w5 ^! I) s1 ]+ W# D& b  
) _1 ?1 a0 s1 X$ p  -a Resolve addresses to hostnames. $ q  m2 U; O0 V# O7 Q( y, Q! n
  
# C0 H: Y7 K8 H  解析计算机NetBios名。
% x0 H$ c4 i3 I: E; s  
- c# d( g# O8 ]& ~  y  示例:C:\>ping -a 192.168.1.21
* n; j/ a  ]  I6 R! z: s# H  
- T& V9 ]7 E2 l/ {  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: " V6 b4 }; y* h* V0 R
  
& v( K' u' e: x4 k  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 R: r6 t, t6 s5 F: K
  
' w1 P1 q; P* o# A6 \  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ ^- U4 f: ?! x# E$ i  s# @
  
# H# F4 b' Y. t1 d3 Y0 p! N  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! v. T3 ~$ I6 V' Z
: H2 j0 d$ f0 t+ M
  
# h5 P9 ^; b; l" N3 e  h  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# X, _4 i$ G* [" W9 @5 J   4 b! s3 `2 Y5 G1 n. u9 Y8 R+ s- q
  Ping statistics for 192.168.1.21:
7 k6 `# p  A9 e. F+ B6 ]   " G# q4 f1 [: N, f
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( [/ W3 Y/ }3 R' B4 J
  
2 x" Y" M+ ~- `' R  F) s2 O' V  Minimum = 0ms, Maximum = 0ms, Average = 0ms , E+ i& C  t- o" y) R
  
1 x! c. x5 ^  T5 P" W# Y  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
2 {+ H8 }* G2 U+ n   ; X9 j$ g! l4 o6 N0 Z. m, e. v
  -n count Number of echo requests to send.
; `" K8 @* c8 F  J  
  J1 i, P# \7 j9 a3 \8 p' @  发送count指定的Echo数据包数。 - b7 D; w# X9 `0 i! m
   # p% `/ l$ i+ Y, }/ I* N
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - [; s" G3 t  `9 G( H" S: ]9 T
  
( r5 J3 O- d9 K0 W  C:\>ping -n 50 202.103.96.68
$ K) J8 j5 l, {* p+ V; ]0 P   + W7 S: Z& G( ]+ d7 I4 n" w7 D
  Pinging 202.103.96.68 with 32 bytes of data:
& j( E8 e7 ?0 S, w) k! W% W/ l4 p  
8 S$ ^) }4 K1 E- K/ F  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' t# t4 e$ Z" {; d/ o
   & [' u, B$ x# @6 x0 |, N  a
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; Z& G# t0 ]4 R& O" e( }
   # m! S; ?/ O$ l
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - e" P, q7 q/ `1 D
   9 {$ z! m, d1 O& Q+ i/ ^
  Request timed out.
2 \# ?5 c/ O+ R; x5 V# A9 A  
- f/ ~/ J: S( r( c# t3 b+ }  ………………
* `. |3 P: U9 d! L" E% J  
2 Z2 ?. c% j% _, j; w" e" B! U6 o  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( D% z4 Y( Q5 F2 g: w6 ?
   6 [* `# d8 s! e1 K
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( M% U4 V5 Y$ z& G' U0 X* A: R  
" O. s5 B- K0 i# ~  Ping statistics for 202.103.96.68:   U8 @8 A9 ?+ L# u# u% R7 F* [  y. L
  
. K# U2 ~( n% s$ @3 O0 q# U  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% [, ]+ M  t! o0 }  \0 ]   ; d0 @' v! [# I. O3 o" ?
  Minimum = 40ms, Maximum = 51ms, Average = 46ms / C0 b" x9 K) J3 S- P
   % s# i& {3 r9 ?8 e! y+ |2 o3 r
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
% c# |( k7 E4 w7 k8 ?9 W; s& r   * ]# D4 Y9 ?* V9 M
  -l size Send buffer size. 6 u  q! s. o! {0 x, F8 X
  
4 s3 n2 P. y" L" b  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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