|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 & K: I( J- l; u: ^ `; K
0 m2 X; v% B2 y6 Z: P1 R7 E( n
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: , u* e- s3 t" W0 ^5 l$ E% f+ Z
+ H6 w3 c& `& @: w 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 # B" w6 }/ Q6 Q' r
+ o, w8 @# g2 ?% Y) P$ ~4 _% g( Z
Options:
6 m% N% N0 ~; f
! h7 {; {" n* n: {" } -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% o1 v4 _8 C& Q/ _: a* N
1 l. E1 d2 ?; F2 q0 v 不停的ping地方主机,直到你按下Control-C。
8 b M: r9 t: u 4 h9 e* P& Z& p6 c0 i6 _
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ; J2 g: ~9 p( ~& V3 d5 C& o
! B9 ^4 ^/ U* x3 R -a Resolve addresses to hostnames.
" i" o5 I% K% W; Q$ B* K8 R
" o2 {8 q: U0 @% T$ g 解析计算机NetBios名。
% V+ g! F( O, @9 E9 R, O- _- ~ ' ]. b4 o# f2 S7 a' L
示例:C:\>ping -a 192.168.1.21 * f/ V& m3 E5 F4 P
6 L: O T; p2 f$ |2 z' z1 h. X
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 T4 ~) N. C+ T
, ]) j- u3 N# ?# m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 V9 c% z, @1 z. O o$ O2 f
& T8 ~8 C$ r# `& `. b- A/ Z. f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' m6 l: ?; `2 l' M! o. G2 ^# Y% x
3 Y3 a0 Y% R( W% A# o' k3 ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 R% p( u' Y4 p# P7 a: B6 l9 P' T/ ~5 O2 P+ k
- c2 ^0 q4 n% ~! ~( p6 ?, ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. X" m3 m5 ^6 F7 _ 4 @7 T# F: Z+ a; C' y. f, e7 |" ~
Ping statistics for 192.168.1.21:
2 E' x& q r S7 F& C# n, |' O0 _: n 3 `* z( w1 f( {; z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ; ?/ K$ g" w1 }. [
3 I4 S% h, D- c# |$ q8 a
Minimum = 0ms, Maximum = 0ms, Average = 0ms
, w! \% w2 R, d7 a/ G3 J
) b5 [: y8 V: n# }) A: O 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
7 Y9 n8 b% q& K$ W / f8 E8 z/ T1 U2 T. f+ j
-n count Number of echo requests to send. 7 t7 X' |& F, C9 P
4 A4 K( B4 a* @; \1 P& f! n 发送count指定的Echo数据包数。 + I- W, V @- l0 u
" h- I4 A4 O# j& u: N 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
9 _. X1 _/ ~. h" q0 i% E % v( T6 J' T# U0 C( \% f% s
C:\>ping -n 50 202.103.96.68 / r" g; n/ P6 @4 x, H
' T6 {% x) ~. | g4 ~2 r" m4 r Pinging 202.103.96.68 with 32 bytes of data:
9 h' h% }+ d# j' u5 Z0 j 0 z6 ~$ Q/ M& h6 v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
S8 b! ~% q" j! F9 F " P5 S# L6 s; m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# \8 ~/ d3 U! y& C1 [( m. W M& X . j1 V* M. H+ g$ R$ u" G) e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. N6 O6 ?8 @* m4 `3 H% u# ?) g* ?
* ^* V7 r! U! A$ g Request timed out.
; E' W# L" v: D1 H+ y
% N2 v9 w4 A7 u: z2 i- w ………………
" ]7 @/ h. ^8 @1 s
$ G+ M: J' ^% j" q8 z3 l y: U Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 V$ x4 X& G0 t1 D: T7 q% T
8 L% ]6 `- B6 G+ ^$ S1 f+ ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) J2 ^" ]& S, S0 M( h 2 H8 S' J. X3 v/ d) H0 T6 z& I% o
Ping statistics for 202.103.96.68:
! ~) z1 ? V- _$ M J- l; O9 H
/ r c L" T4 l5 O) ]5 G2 G# N! A Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" F% y" F' y0 n% l q) k. a - i2 {5 T, K7 ]3 a( f
Minimum = 40ms, Maximum = 51ms, Average = 46ms $ C0 G. j! |' S# y H
0 Z3 u7 d4 S" n7 A& d; {+ I
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 c0 r7 [' X9 t7 R; o0 A b5 H
1 r( o' G: U' c6 `; S# b
-l size Send buffer size.
, E1 W# x: j8 |) r$ `1 W * B6 t, s. z& @; [5 Z- c7 ~
定义echo数据包大小。 |
|