|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
8 j8 y% w& A3 J2 i8 X 3 V2 W2 O# ]; e# Y/ q, H) D' o
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ V: A5 J- b8 Y2 }0 b! U4 _! y5 V
8 r/ v# K; R# z' A/ O$ m- d# |' y 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 i3 H/ N: S& }' S0 X
7 {& x3 h2 D9 ~7 l% Z) y4 d1 @
Options:
$ b2 ?. P! E0 j; M3 S & Z' e% w# a; l3 q4 c) ]
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 G0 R/ F' w0 g
! Y8 @% q% y. a& B+ t' J 不停的ping地方主机,直到你按下Control-C。
1 m- z# V% P/ H9 `0 X
) i/ m! @* g G2 z 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 k6 X+ \' a1 }# x) l1 Y. D " B! n& N2 ]; ?7 w; G. |
-a Resolve addresses to hostnames.
2 h+ J7 c$ b* d, B+ _ & a) w" U7 p8 u8 B8 W* g6 [0 D& s" g+ E
解析计算机NetBios名。 2 D, E4 i% e' J( ^ P
! Y/ A0 M- W% Q+ H2 U d; R- h 示例:C:\>ping -a 192.168.1.21 3 {6 K( F: z' ?! c
( R# E0 @! q& Y0 B# X
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" _9 L# c2 X/ G1 s8 F 2 ]6 S/ X, ^+ t# Y4 [. V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * ^- k! h% h, K; K! i
- e3 C9 Y% ^- p7 A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 B, ?# h$ ~! O |9 j
" T- H! g* h }" o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! K6 y( Y/ h8 [+ _% a3 j/ E3 L9 i/ |- }
: S0 E/ r% `6 N- U7 q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 B2 n& K! x) X, i0 P/ t6 ~! ?. X( G $ I* p& y2 t* m5 W5 J
Ping statistics for 192.168.1.21: $ z% s& y) i7 L n
V. v# I% _6 ~+ X
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ' ?' z+ P$ i, y8 e4 H
! g7 E% h2 g6 _6 i$ M- Y& b
Minimum = 0ms, Maximum = 0ms, Average = 0ms " G, |* H9 I7 L1 t8 X; Z
0 d8 G! z% r# W- `
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ K( q) e& D& F + D3 g; e) Y# P2 L
-n count Number of echo requests to send.
( {, M& c3 a5 |. l% n9 g: h; S
. B, b1 r# I& C6 ^ 发送count指定的Echo数据包数。 " }$ O y1 [ Y* V5 W6 N
]# p- f* j: B9 [ E7 D1 O 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 2 ^( Q6 O) V: I, L
( t9 g6 q1 I' ` C:\>ping -n 50 202.103.96.68 + E4 i4 b/ s! M8 c/ `
2 A9 ^- I0 s1 l: [$ p
Pinging 202.103.96.68 with 32 bytes of data: + ^. e# [2 B& w+ P% Q! V
7 g2 J' m: p0 ?3 X, P+ c$ M; \6 E) D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 S3 i+ I* V ~ ) o% U6 V( }( a5 ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" q# { ^9 |5 o4 v c* v 8 T( s& N4 }: _2 V. @. m M3 c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 b/ K# }: E* I& `( X% I $ \9 A" A8 G' q% N0 L) I$ g
Request timed out. ' y: J, ^. W/ q. t. T
5 U( g% p. l1 q" K; s {
………………
' t I ?2 [5 S2 Y7 ? ( O0 A) C( r0 [7 \! M, Q9 D8 l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 e( v k9 `5 }- H5 U
* q: `* ]2 h1 W5 J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* E3 ?1 L( w) [
7 I( `+ N% p- r; K- U+ i0 K Ping statistics for 202.103.96.68: . [! U; Q9 y* ?- N4 w8 }: B
3 v" h' d' q6 ^+ e4 H* ?9 H Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 `9 `/ a8 W7 X+ S5 l4 j) `
+ l% V( _6 w! O: }' j Minimum = 40ms, Maximum = 51ms, Average = 46ms % x, d, ]9 c. K" `! e; b
7 E# x5 m7 s4 F8 b, {
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 & K% Y3 w: H# j) i. M
c& l w8 v7 Y -l size Send buffer size. % c" \0 e% ^4 a1 ]/ Z( ~6 P
5 G& \8 I& G* V4 ~/ s 定义echo数据包大小。 |
|