|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
# h0 P% c6 J% r2 x1 t6 } 3 c# D2 B1 A) E5 W6 I! `+ Y
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 V. s3 u& p+ Z+ H- b$ s( ^$ ^! l5 M 0 s) Q2 C; O! e$ q: M9 h, n
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 ) v7 l/ S) n; L2 V6 [3 H0 k& t4 R
% S1 b. e- |8 t+ ~ Options: . M! t I$ e5 X3 K" b
% I7 G% F& \- D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- V2 S% c* o( }" j w" ~& e6 z$ w: x" M; R. C
不停的ping地方主机,直到你按下Control-C。 ' v: `1 f9 K0 B b" K
! p4 Q+ e P% v( a/ m4 R 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. H, f. W; ^: e) m( [3 E4 T4 Y
7 t4 x& r6 T$ F& L& l -a Resolve addresses to hostnames. 9 W3 v% @2 E+ a5 i: L
& a5 Z! s3 X3 d1 X 解析计算机NetBios名。
/ w( O6 K& h& I7 X, E' o . h( V9 K* J6 Z1 ]* r9 f
示例:C:\>ping -a 192.168.1.21 " Q( m1 o( C3 H6 M& u
3 o0 a" u; J/ C
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
% f4 Q2 v! u6 F1 @4 O1 X3 q3 s & A$ E+ C* z/ H- ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
v, B% c* J9 Z# l- E
5 O# h* ^; l5 u$ w% u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 v3 P/ c% y- w e
o5 N* b2 h! W; {# z& j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) m' Q3 @8 r; f- g/ J L
4 a' X% b j/ t" Y. k% E & Q+ I; n7 s/ Z, p7 d5 C M; ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * Q! u( z- z9 ]
$ v) ]; x" ~/ f) C- |
Ping statistics for 192.168.1.21:
4 L" _# n0 X1 @3 U# E6 `' f4 F# ?
! @# ]: N2 |6 B% D5 m Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 r- ~) a6 Q# n
8 i* x2 v! q* d
Minimum = 0ms, Maximum = 0ms, Average = 0ms
' O N4 O: m0 j7 u, ` e , y. {3 x! `1 Y' a2 Q( G
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! ]( w* p4 S5 f: J- C C
8 T6 L# r9 a/ a$ F- E4 O0 f. j) G -n count Number of echo requests to send. / V: {5 d; i6 B2 V' |! }2 z9 _) q
* y6 ^$ l1 M4 J/ G) [ 发送count指定的Echo数据包数。
: |; ~2 a+ B% i/ L* p
1 W4 s: }7 g }5 } E7 E5 S# D 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: % D6 P. e* l" m D
6 ?9 i: T% l- G$ t/ A3 z
C:\>ping -n 50 202.103.96.68 ?: K( P5 r* S) S/ C/ @
. s- y& w& N1 Q, \
Pinging 202.103.96.68 with 32 bytes of data: ) O# y' x" E, }% `4 V1 X/ q4 N. T
7 W1 Z* [$ s; ~' }+ `% d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 M3 S$ { q) @! g- f! c& \
, I* r$ j9 }; _6 u. O' q+ Y6 v8 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
T0 _) [8 V- X2 ~1 G 9 k. a" e- w x, }! v- i" ^' n) w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 S& T0 \( J9 h# U" L2 N
+ l: f4 {( l" _, `! z$ K! |/ s
Request timed out.
1 l/ R( ?$ R/ u1 O + F& f3 T- W6 h( [5 E
……………… * j4 ]5 z7 J5 k1 ?/ `
: S( L7 N! l* B1 @% [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / L6 r2 r2 H' ]8 L1 L W
1 g j( z5 t& k4 S# u2 ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 ~4 q8 ^9 r7 L " q) q* _2 s" y
Ping statistics for 202.103.96.68:
2 s5 p0 C% Y& @$ k' L7 { E
6 {& d r# S8 |3 G Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 b# {* K( g& H, Z
/ J, }, D# y; H% ?
Minimum = 40ms, Maximum = 51ms, Average = 46ms + T3 x- h6 k h. y7 k. p8 s
% L P( h5 S$ Q; s9 \# z5 w$ o 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
# x: c4 l) d- X 7 B$ ]) b2 O- s" ~+ q! n A( {
-l size Send buffer size.
1 x' _$ `, e7 [2 g5 h, {& E
+ G* A) X( G0 {' u 定义echo数据包大小。 |
|