Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
: ^1 F8 C" Z8 O2 a  
- w* H" B8 B6 t* ^/ ]5 e$ Y  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ P9 J$ B9 R" q/ Z  
+ r* p: v; W1 L5 ~4 w/ p4 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 3 k* S8 S1 ~) V* C' U% W
  
( w8 @# ]2 ^% _' c/ U  F  Options:
- B& D: F& T* q0 W1 L   ( x: X! X- |4 `
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # [  b2 H' P! g: @0 }
  
& ?: F( l- I6 I* L1 X  不停的ping地方主机,直到你按下Control-C。
" B" Y( G- ~7 a, B  ?  
! |; D1 `9 u2 n! W& |2 m  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
- P/ p. o8 ~+ I8 k  
- f, [0 |% L* [  u9 c; ?- p% T+ u1 ?  -a Resolve addresses to hostnames.
2 _$ R- T: @$ h8 W  
3 f. k  O- |6 T7 C6 q; t$ |5 V  解析计算机NetBios名。
$ R0 G& \% m0 m' f  
0 V. P# {3 i1 r! a; C. _  示例:C:\>ping -a 192.168.1.21 & F* }# u* r6 l& e
  
7 |* w! ?! V0 E, c/ m0 g- j- N  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% p2 a5 {4 ^: B' C& E$ Z) w3 N   ! E4 Q5 |) q! J( d" Q1 [
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ P3 g9 Q) J- c  
) K% Y, @) k$ N2 o  r- X( C  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 a, w. h. t. u* n6 N; I/ M
  
. x0 a9 y' `7 k; F6 K( U; N1 g  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) o! E$ `2 R' f: g. E$ F2 o& F/ j  ~
& F9 j, t0 q+ X, F  
2 b% y  J1 a' l6 ~4 |: l& w  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 u5 ]' W: W; W% O$ t+ W% g+ k+ C" k
   # s( y6 {5 }' {& G6 \
  Ping statistics for 192.168.1.21: : d5 N) \* s" w2 e) e
   7 o4 z0 W2 Q  d
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , D- _& Y3 F% C2 U" ?
  
* x# r. b3 A$ ?  Minimum = 0ms, Maximum = 0ms, Average = 0ms
# v1 I* U( I7 |   3 m$ f' i# C4 P' m) t' L4 x" H; d
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
1 B& |2 i* @0 Y4 p' u% J8 e0 A   # w$ i! Q6 Z& e5 c7 g
  -n count Number of echo requests to send.
+ D: F, i0 u8 g2 _6 s' Y& q  I0 h   & W( i2 p4 o+ K4 I6 P
  发送count指定的Echo数据包数。 % z& Y# E; o9 y
  
" b& m; M7 Z+ J% d* N  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% f" a# k' b9 t, k( s+ i5 s   & J  @2 j" |' f
  C:\>ping -n 50 202.103.96.68 - L0 D: p, h( o8 ~4 }4 l* ?, t2 Y
  
2 J8 F5 o+ I5 G  Pinging 202.103.96.68 with 32 bytes of data:
3 A+ o1 ^. j& N  N/ B  
0 [+ C8 x& j: u6 T- N7 U& d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
  J  T# G1 y8 Y7 d9 ~% C2 y' |1 {" X; C  
2 j6 V9 r( l- ?3 I  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( f$ x2 X( O/ n4 E7 m) o  
& u! O; U$ }4 g3 C9 `  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- V/ T8 F1 h' \8 I& K8 B$ v/ C   8 L4 J3 P: _5 B/ }+ z
  Request timed out.
- d7 }* T4 h3 y$ Y  
) ^9 R; \: A; Y- O! M# s, b  ……………… & |& e9 t! e0 `4 |4 U1 z
  
/ e. ]1 Z6 _1 m# [' t* _/ M4 d  {  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 U# r" I5 R0 ?2 p; `; E, o  
* S* N9 Y( V0 B0 ]6 E9 ?) e  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % z) v' v" {% v
  
) r% L5 ^  G. {! [  Ping statistics for 202.103.96.68:
2 e/ L% f$ W1 Q5 z  O$ j  
9 x/ \" x3 S6 v  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
  r; \5 k# u5 u; A0 ^  b" g  
' P0 [5 @6 ^8 H: v* k: j& M  Minimum = 40ms, Maximum = 51ms, Average = 46ms   K/ }. u; }+ y2 f( ?0 B/ M
   % Y: v. Z, c" y3 M% b' B, a
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 E% c/ A# o8 a# g4 z9 l   , T- j' L+ R3 B% Y- [, `3 C% V
  -l size Send buffer size.
# e5 K6 X$ w$ Z. D+ X  
3 @4 C% O3 Q. S  A0 {3 F  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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