对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * C. n8 X/ i4 p: W
/ }) f. v: c' [" a8 Y7 _ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ' P. `' {/ \' ~0 S' g
% ~9 Y: q" C" S0 o: J 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 1 h/ L' s/ `" I4 e; w7 r & d1 b( [. _, P5 M4 ]; H
Options: 7 R$ u! r9 A& i: q5 g & g* y, h4 f5 r, A6 k
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , l8 \% u( R1 X4 w Q/ [
' t, ]1 {: ~+ A0 q 不停的ping地方主机,直到你按下Control-C。 ' g; n X( ?3 ?* C7 J. c' b 2 h; v% a6 I9 z/ I$ J
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) R& [. q" f e1 W& a # m- n t0 K2 \( F( w
-a Resolve addresses to hostnames. 7 Y8 i, k" d ?) r ' P' S4 E N3 F1 o 解析计算机NetBios名。 ) F0 V% N5 g* t4 p4 x2 d. W |
# P7 c( s, k2 q" }) A$ N
示例:C:\>ping -a 192.168.1.21 7 [5 J x! W5 N" u ( \: w/ {1 L; K& T( g Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 0 T4 K- L' m# A+ q
; v% { n$ i" T5 Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " E" t4 y: a E& |) p r4 W' u ' G$ @' [0 Z$ N- y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 P" o) ]) t! R9 w5 ~, h
7 ~" M$ f7 i8 o3 e ]0 z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & m% F( p# c h4 ]0 \
[6 C9 H+ }8 X9 b* {4 }' t7 O4 \0 G+ y( A
' ?( E: Q/ w1 K" T, x! t+ ^0 `7 q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + [' N) k1 v5 c: Q9 N) |5 [: N
8 v8 H6 W+ {# T) c' @. g5 \. A! G
Ping statistics for 192.168.1.21: ( b+ ]' w+ }) P
* _* q2 d/ Z) t! T Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 7 a: q! I- I. r. d7 R0 q
9 y1 \) Z! `' g3 ` f8 i Minimum = 0ms, Maximum = 0ms, Average = 0ms 0 M1 r5 }" u) p+ S6 N d [9 h9 A! T- b3 G
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 T- p4 v' a4 n% A
6 H8 ?4 k! C/ c! G$ U7 o* C -n count Number of echo requests to send. ' U% b9 X1 v- C" _3 b
j* ?2 E) x/ N" ^1 |0 p 发送count指定的Echo数据包数。 3 k( C- c6 j8 \* S0 }) n$ } 3 U( {% A0 M# [9 O5 M, A 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; q) b4 l; y: _5 Z& @3 s7 ]" v 8 Y% |, Y" m7 j3 z O0 U% N3 d* } C:\>ping -n 50 202.103.96.68 4 V0 e5 g' t0 f$ Y
) P; U& P, ^; v' ?) i/ J& s
Pinging 202.103.96.68 with 32 bytes of data: ; a' @( f+ ], X+ B. _, E6 r
5 `$ X: U, h+ _/ N- w0 Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 d: ^$ X1 S2 c5 X3 x. l
# {6 p$ I: h# k! Z) ?# F: v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % _) j. S. \' \" p% V. p 5 [# B+ e0 o5 G0 Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 M6 L0 N2 i' Z/ B: o 5 m' k* P. p, P7 P
Request timed out. , R, Y6 l6 Z- C* I" T
$ x! j# o* t4 k6 Q% p% J z
……………… 3 p9 v# e8 ?2 T! @8 w
3 f& p4 V1 o" X9 |) x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / V C0 \0 \7 b- ]5 e0 c" @
# o( k6 C" { K) J( F Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 W: x& J; [5 _! O G
+ `3 H1 e" X7 z) _8 X0 y7 M
Ping statistics for 202.103.96.68: ( H# s& i- f7 a6 h / Y% x* p+ {, k& o. w7 [: [ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: g* K) V+ O7 ~# d/ ] q+ j4 ~+ }7 N3 n
Minimum = 40ms, Maximum = 51ms, Average = 46ms 6 e; t7 A7 ?" e* } 3 f1 i5 o, b. Y- N
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 2 a/ `1 E; j2 o7 e: b 8 R/ |) [) Z, E* f -l size Send buffer size. ; X+ o; O$ l2 }( d" ^1 I* ~% a* [& M
/ j/ S0 s, I& }6 W3 A3 d
定义echo数据包大小。作者: 冷雨清心 时间: 2008-9-25 15:54