对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * U0 `8 r0 [. o, I, S, C" E. R- Q. K # k/ k$ f2 ~: f- a$ X 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 M0 Z" d3 q1 U H' S$ i& }" W
3 C/ ~/ y" ]" A7 M" q 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 % R' A1 B$ g' ^7 F( M ; B. d1 e: N5 K; s5 }* Z7 `
Options: / N/ ], j: c1 y. m9 U8 |; A 9 q8 [2 {3 e8 c2 V -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. % n- B! l6 ^" A
% W' Q' B$ k% ]0 `; z 不停的ping地方主机,直到你按下Control-C。 : c6 j8 C5 Z% _- M
% D4 D7 Z& N- g- @9 D8 e 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : L" S4 f J' v" o' P3 R
) n) E4 k, q4 m1 g. _ -a Resolve addresses to hostnames. & |6 c, A, Q& s- {% |0 T ! \( q2 s+ s& J, t6 @6 O
解析计算机NetBios名。 + _! B4 m8 x; e 4 r0 D& e+ ~# Z/ V- {
示例:C:\>ping -a 192.168.1.21 - e5 {% J+ H9 f# p5 f
% c' s" {" p* P Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 9 B4 W9 O, f; c' M( ? & |5 @8 d2 n- ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 k; n% `6 `- F) W3 G / |. K2 U! r! c: [$ ^* q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 G8 s9 T( I- u
$ @, G8 u2 C+ F& G6 x+ ^4 u9 V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * E9 I' G7 K0 Q! ]$ f, g) U4 l! N
1 L0 P$ r7 B) b' H) ^
$ S8 Q4 _: J' q+ v3 ^1 U0 I4 s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / c% w# o$ ?' ~3 h 7 o) {! y1 P$ b r9 t; w r
Ping statistics for 192.168.1.21: & J+ d' g- M' q5 o9 W' M; a 0 X# q' k; y7 G- y( U
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: " b0 E! t. B% q* j; P , O5 Q* v' N; }$ ]6 \ N Minimum = 0ms, Maximum = 0ms, Average = 0ms & }$ X! W8 u1 w; N " i' C+ {! g* X) ?" b
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 3 E4 f4 I- N/ J' S8 R5 V( o" U
0 G- K. \! J3 z- C1 O+ C
-n count Number of echo requests to send. 6 p; U3 S1 s. \* ~' _5 F' Z
( S) z8 l6 X/ e& @( h 发送count指定的Echo数据包数。 , s; `& V& r* a/ K7 e
8 ~: q% ~& `" |7 h4 F, g4 Y
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( O, M- D N# v+ v% E; s! c
' i6 \( r$ u4 f8 c+ O
C:\>ping -n 50 202.103.96.68 # z2 C* `9 l5 ? 3 ~8 N; i, [- H5 T, R
Pinging 202.103.96.68 with 32 bytes of data: 6 K' J1 y! e( \6 p- x3 m
7 c9 ~2 r" W& W& s& n7 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + _4 M7 Q9 ?) O$ E3 U2 o8 O
* y$ O0 ?% T. y7 m t, c( v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 @) E5 a5 l& e/ O( M) t
- q7 z$ c8 V* k4 r' h& X, X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( d' s3 E# ^2 n. a- [
! g; A; G# L2 x/ p$ S+ ^( Q1 y4 M Request timed out. ; A, c# W& g% c& x N& R$ t* M " K1 D. h1 p( P% k
……………… 5 h& O: @. z2 g) ~/ ` b) A; i* u1 c: q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 O7 n! ~& T- x ~; P! V# d
4 C6 B y. w+ D4 ^8 [) O$ N. T- J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! _& u. |7 o, p, n6 L6 I6 D( O 7 I; q2 l& `7 v A- E Ping statistics for 202.103.96.68: # a7 a3 B; O' ?- W2 O2 Y : b% W. N& `. W$ Z( ?
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 6 |9 B- F/ ]3 x6 r W
. q, A# b) T, z. O5 q: x Minimum = 40ms, Maximum = 51ms, Average = 46ms . P6 G/ N' X6 a. K1 L$ [8 Z 2 R1 @# i0 W1 R 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + j" S9 \& @ r5 G/ d' L+ @ }. r9 N2 o/ y- @/ i
-l size Send buffer size. + Q6 ?+ x. P$ y6 v' `
/ e* ], X: @+ L6 E
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54