Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! N) A9 L0 m; C, V' W
   ) r# W, E  k9 Y4 L, D0 w# c
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ; q: u- f- m* N& x" m, z; \
  
( T  j7 N* Q, p5 r. f1 S  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 $ I) B1 L, }2 }$ h3 D
  
& ~; g0 i: s- Z, N, N8 U2 G  Options:
. i; j" F6 J, [  B& A/ F   ; I$ X0 G% z* B& n
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) B( @# t: |* m: o
   % }+ }2 A: |2 x* w4 u4 j6 d
  不停的ping地方主机,直到你按下Control-C。
6 N: h8 t! r; c& g# r  
& c: C1 G- m  N  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 c5 @5 J- J9 u  
! F2 c9 ~" `3 X0 v6 A+ f  -a Resolve addresses to hostnames. 4 d3 K; q* r9 l( U- n
   & g8 h( e" k2 V6 ~! N$ F
  解析计算机NetBios名。
/ A! Y- o0 |9 B8 P( \3 C   0 _7 i. e- l: W# r1 e
  示例:C:\>ping -a 192.168.1.21 ! h2 W( \5 P# C: N' C
   $ O) t: b$ {$ g; P. o
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # j- ?) q( O" V. K
   4 Q2 M: W' ~8 ]  f5 m& i0 t9 ~! d
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; }$ Y7 D6 s9 J! Q3 h* U: |5 H# T
   % y/ O- p) Z, ^' `
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( m0 P2 W. I- x' K5 f   ; Q8 `4 z2 p5 v! `$ z) q' v
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* y, y1 r4 R9 Q9 J, f* T
( R& D8 S! N4 j9 {. P   # f/ I4 O  J4 s& C8 ~" E
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : k, a3 |, v! ^' U  _
  
7 s: S, D* T- I% |* @: g" C+ @  Ping statistics for 192.168.1.21:
& G7 Z9 C5 {7 L   9 [- @; i. q' N* {
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , A8 W1 c" _: ]. K& {
  
. |! W9 u( R" H, N3 R* ?# n  Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 @+ m' p8 x  h7 Z2 w  
- q4 G* Z) Q& d7 G4 W  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
6 G9 T, D6 K; c6 q4 W   ' O- U* y: C9 A4 A& F$ ^
  -n count Number of echo requests to send. % `0 `& k; k3 E; ?; o  O
  
5 G6 r- S- M, h; z4 V( B. e' D  发送count指定的Echo数据包数。 ; ^0 K! Z* k5 f1 s7 Y7 h
   / y6 q5 @" O$ V; k
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 q+ n( P9 m( I* {" p0 g   ( D6 |9 K; a" g$ l: m
  C:\>ping -n 50 202.103.96.68
2 Y; \. w* w3 t. z, K, u1 w   ' Z9 B8 D! `6 Z9 Q  Q4 g& p* P
  Pinging 202.103.96.68 with 32 bytes of data:
7 e7 f" j4 E8 C# m! C3 F& ^  
& c3 l8 w! Q4 M9 d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# u7 [/ Q4 j) t$ ~  f2 {% C& n  
; h$ X. O' [+ d5 M* k5 _) O( `  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& t3 B5 r# Z4 r" l   $ s; t3 W2 }. z( r
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 K8 c( \9 ?6 h. ~7 G$ r9 H# X
   5 E2 N. b# o' h  U
  Request timed out. 6 n6 U/ r# ^* p! p3 P' ]  S
   # E8 K5 U: F+ _: S( O
  ………………
2 `5 e. n+ E0 f* z   . [; T9 r- |* N! ?/ \7 o# `2 U
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ l" x; G3 i0 p# t   / o4 a2 Y& ?. c& F( R
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : H% ~5 w/ l, c9 ?4 }5 o
   + S. J- ]5 w" k0 b* z5 I8 z
  Ping statistics for 202.103.96.68:   t! L- g/ h& k) h9 N
  
: \9 {$ P% p) S7 p, H- L7 k3 h  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
; X) a, {$ T+ y6 K   ) K& t3 K, V+ G3 i* ]
  Minimum = 40ms, Maximum = 51ms, Average = 46ms % ?. ~% Q/ C' m
   " E+ Q3 ~5 f% T& {: Z% m$ k; |
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 D( k, k" C4 x5 b7 h
   / G4 B& G. l: b' Z+ N) n  V
  -l size Send buffer size.
. e" |) x. |5 x% m2 N) O5 h7 z  
, M. v- Y! `1 y0 a  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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