|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
4 x% |* T9 H; ^% w# a; _ ( X. M- f/ O) }# {& J4 _
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 3 x6 ^; `; p2 j+ d: |0 m
/ a5 _' ^+ [) {8 e 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
( n$ F8 \) o; ?9 s( |
/ W1 ^, z9 w6 P5 ^1 S" ^; G Options:
# J x. n7 |# ^ 8 Q* W. Z; ?3 h
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) U4 P$ S; a8 }. ?! ^9 L
]7 O/ e/ }# V. U/ E 不停的ping地方主机,直到你按下Control-C。 E$ S' W R0 c G* v! r
9 X5 d. X* m* d* I" d
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
- o' u x/ G8 b( [1 T$ W' t2 ~
3 I! a" F, d$ w4 N$ h -a Resolve addresses to hostnames.
' F: X6 k a- I0 `1 M) |! ?
- O# S9 F. m- a/ Q* u 解析计算机NetBios名。 & u% p% T" L/ e! X0 {1 b% k
2 q5 T K. o" y8 v% G6 B 示例:C:\>ping -a 192.168.1.21
; {- Y) a, `/ Q( n
. ?8 R& B% T2 M7 s2 `2 a Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; N/ }/ W0 E& S
% z, h U6 ^& P- p* w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 L7 E0 o& {1 Z: u: F2 q5 y
$ X8 u4 {9 p9 d' ]/ y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : \; n+ y& c0 R: B
0 v) g( w) t, l! ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; e: I. z* D. H, |3 h
+ D5 e( M4 o; W( c- }
* ?4 s. ^9 W% B0 q0 a
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + y' Y' u; g' R4 M9 ^( _& Z5 U, B
1 m4 i8 |4 [, x5 d% u& k" M; ~ _ Ping statistics for 192.168.1.21: 5 ^ `& K) c& [1 C& [
. r# n' R, [# I# L) J2 V" T( A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
' M/ [! ~1 A0 t( M' I) u( {
* \8 ^7 k) u0 t! X! ` Minimum = 0ms, Maximum = 0ms, Average = 0ms
, {3 `$ X& G' _ J/ n9 J/ t6 d+ c
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, \: e" J$ A5 ?! `; b# y : G# w& _! E. W
-n count Number of echo requests to send. ) r8 j( Q( W: d0 l8 G7 |
1 o8 H G3 T- ^4 Z! j- Z @ 发送count指定的Echo数据包数。
. w0 J; k/ C4 K
1 l5 c& K" e8 o% n 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 g/ c" W9 M8 [1 o9 F9 T2 d- m
5 D& }" \7 {4 a8 F. `
C:\>ping -n 50 202.103.96.68
; I" L+ g5 @' n1 U8 P9 V, v
4 \8 t4 |& [ |2 I, X$ z Pinging 202.103.96.68 with 32 bytes of data:
: t6 t% F# u7 b& R: F & K6 c5 Y: R0 x% Y+ {
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 V; E0 D. O; C9 r2 M! i7 A / e$ d, p) c( W& X! ~. V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 ~( V# Q6 X& ~3 b; A3 f
* B) I% u. k+ B5 L, l! w3 D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. Z6 V: E# v+ \( h% }6 o: p6 @9 F 9 t, r" P2 b: v$ m) l
Request timed out.
9 K) G/ h* f$ Y$ R: W7 J6 ?5 c/ G 6 s3 M5 X8 C& Y% N3 f$ l9 E
………………
0 c1 U1 R- l, G. t; t& h* u
3 `! {4 z2 v. Y" t+ U3 R# ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" D; C. q9 x2 j) ^ B9 @
, i% _8 F5 {) c( _! G( ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) Y ]0 H+ |5 X, ~; Z" W' Q; M
/ F, o, e, t+ }/ V6 A2 \9 o
Ping statistics for 202.103.96.68:
/ O8 @: W" D1 ] k& _; T
! I& S9 B6 n4 |& H0 \4 ] Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% Z% K/ ^! w- A/ j+ R! _# ^7 D
! j6 Q* a9 c* M, x Minimum = 40ms, Maximum = 51ms, Average = 46ms % ?, o/ N5 C& B/ Z8 x; F1 Y
+ B3 Z' i/ s h8 Z4 i
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( W) _. M, T x% K
( ?8 k4 S/ }: H/ Z3 j6 O
-l size Send buffer size. 7 N/ f1 K9 d/ [" R8 {( V
( O- X) w9 H( D& [7 [+ a2 j 定义echo数据包大小。 |
|