|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 z- z8 G# w2 X# n$ g. t$ Y" \ 1 c5 i7 f5 f/ L. V2 K+ N
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: - ^' J- n. _$ A; r' {
8 z' ~5 @5 s7 S( e8 f3 K 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 I1 B1 a- h( } n8 Q* ~ $ g$ c, z/ ~: _# n
Options:
+ B' b1 d) N( S1 y: a- m
, P! H2 ^4 {4 Y2 i+ A/ c -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
: f. M- |! X& Z5 C
' P: f, ^* M* S- d* v9 G m 不停的ping地方主机,直到你按下Control-C。
+ ~, v4 y4 g. _- G, b D : N. h9 q" N C" s S f* r0 [
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) a$ M5 E& c; j/ ^
6 Y/ V! n5 @) x# J# p# F
-a Resolve addresses to hostnames. ! q9 z4 y( h& S
* E' D q, g( t3 f( @ 解析计算机NetBios名。
) F8 h) i' B( b% W; V % z' O9 d2 P# u( P' _' D; t$ M
示例:C:\>ping -a 192.168.1.21
* U9 ~- `$ i3 d- L- B
. \9 z( b1 F! l" N Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* z+ L% F5 |1 \1 L1 y; g 1 x/ j( F3 c; f L% L9 Z, W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - b: j8 Z* c' g% h4 z# j
8 T) S5 P7 P; J+ ^. X* J1 J( y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; Q1 `/ Q/ E: ^5 A2 w 7 Q N6 E- O; y' g- T$ p) G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 ^2 D& ^. d8 X" r7 }3 K
! T7 K. a5 z$ P; n8 K
1 K' M/ |4 D6 _: g+ ]) a Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; O! L$ x9 S9 H4 s3 Y
2 o9 R. F8 f: _0 N9 g2 j
Ping statistics for 192.168.1.21: # }6 z J) Y1 S4 j
+ [: `; K) K* ~# t5 P Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 \) ]9 x. j, P) ]8 V
% ^+ [* ]# t# {. f
Minimum = 0ms, Maximum = 0ms, Average = 0ms & p5 |3 ^4 T- f) s; R
2 b% y8 V6 l, @
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 w) L& D8 U# X8 i1 c. ]+ Z- \/ A
7 H; M& h8 i' Y
-n count Number of echo requests to send.
4 o. _8 t0 S- k$ m9 E4 B, l& \( O; O ) x2 W2 M* M* S! G; I* T
发送count指定的Echo数据包数。 1 H, ^3 q# b( |/ }6 i
8 [. y! z. I1 D0 l3 v$ o( B
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
# q7 @5 z; k$ r3 w7 D
* ?- d( _: i2 C, E5 [' Q C:\>ping -n 50 202.103.96.68 & t8 Q0 Q& O% M( Y
! O7 u) B* u! P s, o
Pinging 202.103.96.68 with 32 bytes of data: 0 E& v0 U( m. I; t1 c" K
2 B5 @$ g- H$ W9 I! p# F( c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + |# T# i q9 T7 p2 o/ S
7 D# I: ?( n- ]4 R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + Q; U( F' ~2 N0 g2 z# ]
) a4 \. p& W! P" c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 |/ `6 w3 L! [6 `0 C) j
9 w% F+ i( u6 b' C: M Request timed out. ( T+ N. v7 v7 X& x V% j5 _
7 c6 R5 ?' }: F* W2 Y ………………
* j1 _4 W* s8 Z+ ?) I3 O5 i! W# ~
/ B. V z$ g- D+ b8 z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 I( {1 y7 D6 \
. {3 }+ d* L3 {% d2 i7 W% P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + T1 `, `1 o( r0 e% G; X
2 K" [. i# U, `! c. S$ T& i; {- W
Ping statistics for 202.103.96.68: 2 c( M: Z( Y& D; T6 ?. g0 M; M1 x3 W
0 [5 G0 h* @. K2 X+ W9 Q _
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( P( [8 f, B0 [- }
3 q$ d) P; t* Y4 ~( F K Minimum = 40ms, Maximum = 51ms, Average = 46ms
' ~+ ~7 ^" z5 E Q
( W, v# ?& s# m6 o( e 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 C, @4 y. E* N# B0 a' I
# n) e1 m& u6 i) r -l size Send buffer size.
) u+ U) ?* V: P E5 k
1 u- Q7 S) A1 K4 g" K* X0 Y 定义echo数据包大小。 |
|