对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # ^8 c' F" X' r ( o; F) t2 S/ s. j& @% P2 J& z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: i9 O6 D m w' K: y4 O , W. \3 e' q# z* q) |0 g# c* t
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 $ d. p) D# X4 Q8 V1 s$ \' Z7 i
- \- N0 B3 K0 ~
Options: & x2 b; E8 I" x/ @; g A3 r* z 5 M; _7 X0 T3 V1 N
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 6 J8 a7 O2 ^/ I6 U5 r" o
* }( N* X4 q: Z* r3 a \ 不停的ping地方主机,直到你按下Control-C。 ; v8 h. ` h( i
5 L2 x, ?% J$ H4 r4 q0 V3 _6 Y) V 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 y( \$ D0 X! T$ @3 s* J4 N: H " p0 c" Y( B) |" }+ W! P! r4 K
-a Resolve addresses to hostnames. ) Z0 q! G# D' ]# V7 { . r0 S9 ]* y+ H9 }" s 解析计算机NetBios名。 ( I% @9 U. X l1 Y
$ H% e- }( P' h% O2 B/ ]2 \: @( \
示例:C:\>ping -a 192.168.1.21 + g. s; |- U5 G3 {- h . Z. D; @2 ?( I3 s" Z4 \8 K
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: " u- [( ]+ T7 N) V0 e
6 G( {, C+ N3 u" x Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , ?6 @& U7 C5 V1 o( p6 ? A
& w! y+ q/ j! n1 w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! f$ n" B/ f7 M: n) E! e
" e$ W |9 x) q& t# `; t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 z1 K! S, v- w
$ C, a/ K2 V* d: V' j8 S4 A
% ^3 }6 P/ w( }+ |/ U( G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " N t) I+ @+ v
' {& x1 U: J n$ ] Ping statistics for 192.168.1.21: 9 G: y3 _% I4 w0 c' U# U
1 g3 G N% @% Q7 [: K; z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: & i5 Y* V" [ ?/ b( X5 t+ Y
7 B* B" _ W# M8 ~2 K Minimum = 0ms, Maximum = 0ms, Average = 0ms 4 g# Q- m1 H3 p: Q8 [& p) \
u. z, g8 M. M) I# F' p. S 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 9 _ B# j+ E& Q. z
7 n" F. o$ w$ i# b- M+ R* {; Z% a -n count Number of echo requests to send. ! g# e9 V2 g5 F4 n- h8 x
3 U) e" E3 e# T2 R, ~9 t
发送count指定的Echo数据包数。 5 [2 n9 T9 s: `& ^ 7 K% |. t5 u# ~* l5 f 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - W' z' f5 s9 Z4 J5 `5 [3 V! U. R
( A$ e0 [/ v9 I% n c4 t
C:\>ping -n 50 202.103.96.68 1 U5 y% ?5 h [
2 x4 v- o. Q0 c0 D
Pinging 202.103.96.68 with 32 bytes of data: 7 e3 [& |% x0 R( `1 x2 g! f
% f! j* m# o. }# d* O' d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % K1 j- k/ |9 ?- o9 w% ^ : _5 n( A) w5 ]9 P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - q$ D* C. e( n + h) Z" o& K" V) s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 y8 g( V; f z `5 r' c - F: {, A5 F) Q0 t* M Request timed out. # X6 a* v4 g5 b( {1 c0 [ " u) _* V9 X2 k! J7 r- v7 B0 X* ^
……………… 9 O3 p5 Y8 ~, K8 Z6 _7 t
: G: m" C7 r. b3 [) c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 ~0 ^$ a: f# Q' p
$ [& f$ ~9 I& q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 r2 t. U- ~. ] 4 k" X- o2 C8 @2 E4 C
Ping statistics for 202.103.96.68: 5 A& N' o: Y- m. l $ ~; q. q) Z5 j& J, z& v
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . R. J5 y; D4 ], Q% E 7 L6 c& U0 g2 H( l0 `5 X/ y) y
Minimum = 40ms, Maximum = 51ms, Average = 46ms k- ]7 z w: y! N
, @* N( K& a7 n5 B- F 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 1 _* ?/ ]) U" Q # x5 ?0 S3 h4 C* f -l size Send buffer size. : p$ @" N |9 F5 b3 L) t
3 u% ^7 v& f' A6 w! J0 z
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54