|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
' v! e$ E: a/ E2 J J" d ) G6 Q! R4 M: g, @5 Q7 `+ } e4 x9 i
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) f6 z+ E# J9 J - M# T/ ? x; R# D0 _- e" ~3 U' V
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
' ]+ @& U0 n: j$ K& `% l( I 2 l+ l) ]/ A: G
Options:
7 q6 ]& f$ |0 E+ ?; k( z% {( L" B* n
( s7 k2 y8 H1 `7 ? -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# Z; ]* d8 [0 U2 e5 w! T8 b: d
7 ?* @, l0 @$ l1 q; |+ | 不停的ping地方主机,直到你按下Control-C。 1 F# i$ k q, f% k2 u
4 o* v1 B( u0 q0 k
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
' ^) S1 H3 c6 w$ d3 N: t7 q' z M8 S6 g( i; T" c+ y3 G
-a Resolve addresses to hostnames.
+ p$ ]5 Y. ~( ~ b
8 ^( B) ` C2 z7 T% l7 A 解析计算机NetBios名。 # S6 e: W+ Z( i' J# _; o' v8 }
n2 @0 H' I; n! e; S 示例:C:\>ping -a 192.168.1.21 ( a8 U$ x$ r) E Z
' b3 i' C0 c" V Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# B7 k2 \3 [' F( D4 F 6 k' s& ^' ~/ D& j- W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 g# U; x8 ]+ i& s, f7 X
" q4 m# G# G+ N2 v" B/ u- t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! Q( |% @: k; J Z5 c
% _* R- L; Z4 C! P5 Y' ?/ p
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( n0 M, E: e7 u4 ^9 D2 a
+ Y& P3 u. l! a9 i$ H9 O
0 x: J: A4 l8 h5 L& ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 ]4 B) U$ ^) k$ v% V3 J% P # h( h, j3 I$ Z" D( f) a
Ping statistics for 192.168.1.21:
; z$ N1 I0 f$ u
3 f1 P5 _/ z4 d/ Y: X Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 6 s% _+ c8 \- L Y! k
g& U/ k1 V0 Q ] Minimum = 0ms, Maximum = 0ms, Average = 0ms
& H0 X0 h' I$ }- a" i8 y- E ' h5 ?, r [9 u) B1 z
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 / {; ?! y$ `+ X6 j9 x
& K9 h V& L, Y+ `1 @7 |
-n count Number of echo requests to send. ' }" U+ f* P( `9 g1 X `
. W+ r6 g; k" a) n, Y& J
发送count指定的Echo数据包数。 . ]8 R8 c' b- u5 e2 Q$ n/ E
) B1 P8 z, N, u, Z4 y+ q, g) J 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 A6 E0 P5 f' T: I; |
4 N- b9 \" A) [ C:\>ping -n 50 202.103.96.68
8 `+ z5 z7 q$ i i, X: ~ & L4 g `) }5 f8 f/ ]! z
Pinging 202.103.96.68 with 32 bytes of data:
% g/ ^% ]9 h. V* d- p6 W3 R. f
0 R" L7 f/ \6 n3 [1 g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! m( M. H" R. e. U) q: n/ y % w) r" ~) u+ t/ P6 V- T2 a8 z% h i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # I( ~& r% b3 M
0 q' U+ F, g/ G. @9 w( Q7 D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 b# A. v8 w( x' u! \6 f5 T # ?( L4 Q3 w, x" j. E( w! H' f
Request timed out. % M! e* b/ w0 \6 n/ R$ k
$ x7 E( ~6 i: Q. E1 b
………………
$ w4 K. X9 y% S" Z
" n0 ?% U+ b4 u& U( ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 K, h) E% }, p9 E6 l4 l 8 k. y! y8 P7 E$ I+ I" G. q, e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( w$ m/ r# }, l+ b/ q , u# \0 n I3 R. T2 d0 ~
Ping statistics for 202.103.96.68: . o e- x6 q& F, E5 `' @5 H$ o* W
: A& ]8 F5 F8 J) P7 z8 P, H
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ) x6 a; m ^2 r2 x; @7 M
- G* U4 y% F2 J6 M/ s2 q
Minimum = 40ms, Maximum = 51ms, Average = 46ms 5 X0 n) m! L) L) }: c X
9 m! `) L& Y5 }7 A# W 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
: Z/ p' r# B$ Y - }9 U% B# y. v$ |! ]
-l size Send buffer size. 1 M( v. c2 h0 Z+ ~0 {: g% w
$ Q$ F) \( Z. r/ z/ H4 d; H 定义echo数据包大小。 |
|