|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
' _% r2 v: Z* m2 A' e 5 _( g- x s% C# A7 b
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( @" X1 F; R" \: R
3 B: X o4 B8 Q' j8 I p' T1 ]' J( D 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
" @# C: R: [8 L0 _ 9 `( \7 g9 U( B) k/ v) z
Options: 1 m+ ?5 Q' K( M: k; Z& d
7 K( k ]3 i; O6 L" O0 d
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ( L6 k! l) E$ N; [, v) Y5 y
3 n) C0 \8 }7 H4 n7 w4 I9 t8 w 不停的ping地方主机,直到你按下Control-C。
; e+ _0 r# f; P% u( U+ C 3 f6 G6 M% S8 J# c; f: S
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 m S9 O; o! ]' V- Q
6 C& h! K) _6 | -a Resolve addresses to hostnames.
; F6 u0 }% r1 ^, V5 I; I
# o% f: d5 s. I7 c0 M* A 解析计算机NetBios名。
& J5 w4 X- l: R3 l+ d/ C# h+ y/ M. U
: r$ e* M4 _6 V, [4 o9 \( ?0 ? 示例:C:\>ping -a 192.168.1.21
# p) K& Q6 S/ n; h9 V ; F( ]$ D: y$ [- i- Z( c0 K
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
/ ^% [! m3 C% x, F& B) s
: w4 S! ?0 y# `# S3 _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" L4 n( S8 \% C( Y0 ^$ E
2 a: c2 Z: s) V7 K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) B/ a! m3 @$ e3 f) \$ s
6 N+ c. G* i$ G* R Y' S# p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 z7 Z5 s2 i+ w( Z- e
. E: D9 K t' M' y
' l0 \& W" M7 o% _( C, Q' y9 w& D+ Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 ?3 B5 d% X# _3 b R) |- c: K4 A! u* o ( U$ D2 H$ f6 r3 |& G
Ping statistics for 192.168.1.21:
* w7 c8 z. L8 ~ $ C1 }: |7 y: r/ i1 D4 }! J$ h- P
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # \$ i2 B3 d) c0 }- i6 N7 A
7 {! i- h( {1 }6 {+ Z1 X9 p Minimum = 0ms, Maximum = 0ms, Average = 0ms
0 z& ]9 @4 V. @- W' [: f7 K; Z 1 A3 C. C3 _0 s2 s: q4 `+ e& N
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ) M$ l- f; Q$ @3 ^
! D- L F: A# N# J# F1 y
-n count Number of echo requests to send.
9 ~6 B1 v) o# Z & t) k: J+ Y( K1 y
发送count指定的Echo数据包数。 6 {* k) m1 }4 H. K' \
* S+ m$ \' I, n, B2 M 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
: P, `8 q- m0 ~0 n. B $ z" d+ K7 L( `3 b
C:\>ping -n 50 202.103.96.68
- F9 Q; A9 W; g1 Q+ [' Z
( @: |% c0 T( r/ b8 I8 G Pinging 202.103.96.68 with 32 bytes of data:
6 X9 `/ V' Z/ \3 @5 {0 Q( g # }; M; S i, t; V @7 t. C* @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ ?6 g" Z) S. l 9 G. ]# H+ p+ d7 G _( m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& w" a0 e$ U3 p8 C& M4 ~2 B
7 H2 z; e. e6 c9 Y1 s- Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& D' V2 w0 x5 w4 G $ B0 @% _$ ]7 }; u1 Y( Z
Request timed out. & T0 n2 D. t2 ~5 {- X8 s! a
2 d8 h6 E. j" p# i0 U ……………… 4 t9 ]8 R- D$ s" D. i2 L
" F2 C, T$ i! w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % P2 e- Y5 a! G, e& D# S
) y7 l! e" z5 S* w5 y( ?1 x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * n* |4 ?1 a1 i9 K1 B7 n; I
3 G8 g( B* v9 U' R) h- M
Ping statistics for 202.103.96.68: # ~8 C B7 I5 k" m" t$ p/ J* r9 H( z- \
' E: I, w( v4 j* I* Q+ J& ^: Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 5 S+ U( E- e6 z/ P+ a$ N
, O; z Q6 g1 v8 \5 n9 L; ?
Minimum = 40ms, Maximum = 51ms, Average = 46ms 7 h* n" }+ g# }/ F: v5 q# y
_, g7 ]. p4 u7 h9 D
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 / T+ {- d$ O v; o" `& n4 L
, T% B$ |% ^" C/ [/ X
-l size Send buffer size.
$ C7 T; Y0 @% l' k( f3 b7 H
6 j* Q0 J- o8 U" @ 定义echo数据包大小。 |
|