|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
8 n% @3 \# V- h4 |1 o0 E " s/ E2 W, L, A& D# U
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # R2 X$ a/ R0 M8 x$ X$ O" L& ^
) I+ f0 A/ z8 h- L, l) _ 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
7 t5 V1 y! D8 z* \ 4 w2 F; I2 M. S5 p1 i" \& U0 E
Options: % k K' V6 E; c9 ?. v7 `3 c! y
* b* v4 u1 R5 n -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
0 b' c+ ]3 [/ O9 ?8 v: J 7 Z; {1 o$ \6 D/ p
不停的ping地方主机,直到你按下Control-C。
n! r$ R! E# e; E7 p- [6 B ' r7 o& ^ k9 a; R. t" |
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 C: S/ c8 u+ T. |$ Z( y. g / v2 u( k& ^6 D4 x$ W/ N' I8 J
-a Resolve addresses to hostnames.
1 H/ U. g& J+ {; n/ G# O1 N: I9 D
# c* {- W: V9 Z8 ?5 O 解析计算机NetBios名。 + h+ K/ {! Z; u3 i& Z. D* }% V) z
' }, L' ~; i# ?( l9 _, O 示例:C:\>ping -a 192.168.1.21 2 q& c' L9 K; `6 s0 X
" i& _/ V% ?- f1 b. z6 y1 [
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 h& C3 z3 A1 M# Y
7 o$ }. I- ]6 w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" f; D# ~! A* n+ U: @- W5 F
9 y" h. h3 W9 t$ t+ P. k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' `. j# G" Q: Z
1 g( W0 C* s2 z# s* E1 G* M9 ~9 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( \1 ]$ I; ?5 p# J; G2 R, }6 G( n" N
8 N: W, Y9 C @# C1 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & Q( w, d3 V4 q
1 z1 u9 m6 { f& j* l$ H Ping statistics for 192.168.1.21:
9 U' T: B" w6 l) Q
! g) l3 l/ C; y7 L. p% x Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
! L6 `9 _- K4 q. {( M9 D / }4 M3 O! L' V: E9 J8 v6 A2 N
Minimum = 0ms, Maximum = 0ms, Average = 0ms
& I+ T. i W2 W' n- m' Y8 h) D9 P- F 4 H( q( C; ?) X: l' I- [
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 : C. w' H- r- E; ?) G D, I
6 K* F, R# w9 ^8 y2 t
-n count Number of echo requests to send. ! v8 o8 \0 d( R- S; y% R1 q
! A/ w. b2 G2 D 发送count指定的Echo数据包数。
1 T8 i( B$ q( T
5 |: V- P9 z2 V! D' l 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 C# {! x9 ^ G
3 _, V# F9 I+ D0 j( }4 n" I C:\>ping -n 50 202.103.96.68 7 @5 R( {, L/ K# u4 O
% F! `6 Y% l9 j7 c" a# X$ S3 V
Pinging 202.103.96.68 with 32 bytes of data: , j ~3 f" B4 N6 l$ l* {0 Q; r
, _! n0 x/ N# [- J4 l) c/ J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' X8 P0 ^8 a6 ^ X; v 0 V( ~ U- `- s. v' t* ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) R: k3 M* a% O4 U8 I0 Q 4 T W5 x0 ?, r9 B. K2 Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( k3 N/ S% g$ E 5 f( o# H) i5 M1 k
Request timed out. & Z+ X" c; W7 N6 M# E: z$ p9 g
- t% C( C7 o u: N9 ^( \ ………………
+ I. h2 L/ U5 R- y0 P 4 |' ]9 D r; e/ b, r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% ^( G$ U9 N* _$ S/ f: ?( Y - w% u$ G1 @- K# d# j8 D5 h( u1 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 x4 O4 F7 l0 ^$ S
1 J" m0 ?8 V/ D( l% F( @ Ping statistics for 202.103.96.68:
: _4 ]; o" c8 V$ Y) p / X( W% a9 P6 @, t' B
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ l2 i$ @( D" l/ o. h$ s' K
" m$ S) ?. {; h( `8 c5 K Minimum = 40ms, Maximum = 51ms, Average = 46ms 2 E$ K. G0 A. [4 w. w) D
" v m$ {" b. t& ]4 v. \* v 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 " U+ r6 B6 k% E" [. t, T
: T1 Q' r7 ]1 h c- E) |& ] -l size Send buffer size.
/ r4 o( u9 h- _$ B! p8 p" I# l 3 k" r6 z1 G& Y3 n6 k' Q$ \
定义echo数据包大小。 |
|