|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # h% f- ? ]% V+ S" D) Q$ ]
) c2 m, n7 `4 v8 E3 U9 i 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 {- g" j; L* W* Q
: X) U* R2 I8 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 % g6 |# ]+ f: _+ D$ S" Q
V' Z) r8 ~; {9 B
Options: b- x {# ]* ~
" h- e# i6 w0 e7 j
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
; d/ q% P7 r# d) t( q! I + _" d' ^( }. v$ f8 R7 @
不停的ping地方主机,直到你按下Control-C。 ( ^# ~3 `3 F& |
0 C& m* ^" I7 r8 }1 m' G3 s" Q( O 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
! }6 g' v' k6 g# ?: v @, e) J' q# F
-a Resolve addresses to hostnames. + ^2 p6 D( r0 g
4 M9 Q! H# I7 d* U+ _0 M# l j. |
解析计算机NetBios名。 . u8 H" b. B1 G8 ?
" _& Y5 b# | r0 @5 j7 Q 示例:C:\>ping -a 192.168.1.21 ( s' {9 i. J. T$ |: z& E, N
+ @1 u5 M2 G) a& A( C1 w
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
P3 ?- L5 p; s" t - \( g1 F# L. _8 z+ |/ M+ _7 ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * H5 l/ l b( t2 H7 F* Y' {
0 W+ _* ]& K: k1 O G: V/ D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 [# E6 m' u5 a6 j4 A7 h
8 | _1 Z3 \ N+ ?) {9 d3 d+ \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: Q. l7 U L# M$ f y( m2 c2 _
8 g$ l# k4 u7 y+ D8 Z- f 2 E2 l/ A! e, a) e' N, `! g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- v5 v+ n. N3 N
+ e; z# H1 a! Q2 F m% [1 x+ @0 T+ j1 V Ping statistics for 192.168.1.21:
1 m6 I) J* V: j/ X7 c $ M( C; y; ~( v) p" l
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 W( ~" M s5 [% f H; n
1 P' _/ T( b c; C
Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ P! z9 G* K/ P! j# A+ B+ V/ J
$ ?! \7 \4 Q8 i \' I% @ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, B/ U3 w3 {8 O* `- ^: g& O0 m0 K 7 x) `0 n J/ \! |. y T1 x
-n count Number of echo requests to send.
5 w2 n, x8 i2 C
: Z* N: k6 h* _2 m9 P; _$ r9 w' a 发送count指定的Echo数据包数。
6 ` }. s1 l7 w! O8 Q4 H/ T6 u
/ s$ _1 h4 P8 I$ H4 `1 w0 ]8 X 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: . ~* X- W: H8 i
2 L6 ^1 |7 W3 I+ {' K o' T' s$ f5 | C:\>ping -n 50 202.103.96.68
$ P+ h" S* |" F1 a1 W( a# f
" h5 h/ `( m- W) i, s ]- O. t Pinging 202.103.96.68 with 32 bytes of data: 4 _; m; z; e4 ?( x2 c0 ~
0 y( G/ x) G; I* e% L
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % j5 H& P5 r' s/ Z6 S' q" s
% E: v- V; L1 W' T* d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" @6 R3 \2 M% w2 Z, E0 } ) a9 j# t a0 L. _0 z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! H3 y- x% M; ~$ \. P: [
2 P. |; O, O" b4 b2 s Request timed out. ! B) A0 b" z: \1 a0 d
9 `4 ~; K# c* Z; V# }0 ?4 x ………………
( o* k" i- k- Y & [1 ] E$ Y" W, b) p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 t1 e. \ H9 a% r$ s. g9 |
. I( i& x5 v* J0 ^/ W# R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% r2 t0 A; Y* S# _) ?8 @
' K) h' x9 z0 l' C; h/ T Ping statistics for 202.103.96.68:
! K( `! B9 s+ J/ C6 b6 |# G
, B' x; Q4 s: y# \) T/ T Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . K1 ] S& D8 ?4 Q
/ g7 z5 O8 \, |, w- ~/ J6 R4 r Minimum = 40ms, Maximum = 51ms, Average = 46ms 7 v0 L& R- Y; J% e3 R
) A8 U" X3 Z2 \3 M# r- n) G 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
" `! ?6 E2 @' J/ t ; d! m7 T; }2 W1 G. W8 S) T
-l size Send buffer size.
/ Y9 { T X( A. w: O1 L
# \' K s1 L" h. D( N$ V 定义echo数据包大小。 |
|