|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
% e) `0 o3 J7 C$ N4 o) j" h
4 V) G! O1 O) t5 `, ~9 l 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
; ?+ Q# u4 R8 K- p
' G; M! u# p5 g7 Z, I) P9 Z( }7 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 $ Y4 y1 m" j7 V+ v' Z
8 i1 W+ V+ v( b0 @ Options:
. J! R4 i3 r5 |1 D0 O/ h7 l
/ d# T. O% l$ q/ |0 q -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ( A% p7 u* m4 W& [( V3 _- b& |/ h5 u
( A' q9 u3 G4 `8 A8 S; F 不停的ping地方主机,直到你按下Control-C。 / Z/ I. p3 K& V" A
. l+ c3 u, J* g* b3 a7 Q 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 V0 }+ y& V! H% {& c4 m( |
5 e. E- x! q/ b. ? @- Y: F
-a Resolve addresses to hostnames.
0 v, G' j5 w( f: W% E" z- J! p
w# r0 g' j3 |) m; |2 p" C 解析计算机NetBios名。 / p% {) u" C) e3 |
2 w. |" E6 z2 A" F5 m; x
示例:C:\>ping -a 192.168.1.21
/ E9 u& R+ @& F. u + r- B: m" l* w
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # Y, o1 j* j1 X9 {
/ t( _9 L# W: v9 H6 ~4 @! [9 u {2 x! I
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# l7 N- x& f# y, x
6 d! w* x' Q' u7 P9 Y( i2 o8 B( O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 G' A. y2 g8 ]1 T
! u" `; T m1 m/ H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 j) [7 w5 l* U% {
5 }2 m: \( d4 w+ z$ g2 E $ [5 }$ i. V5 L7 J' ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 \$ n6 Z2 {0 f! V
0 ]% n" L4 f, [: q8 g Ping statistics for 192.168.1.21: 5 R' l6 t2 g1 r0 b0 `6 W
6 J: R) }9 m; k% E5 }
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: - a0 C+ Q- f6 p5 B+ c3 D! f
" j3 \, t }3 S9 l
Minimum = 0ms, Maximum = 0ms, Average = 0ms
$ y A6 ]; u- o0 U2 m
4 c2 e4 V, H3 W 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, I+ ]. x9 K1 w4 t2 J% [1 V5 U
7 U" S% J/ y" b -n count Number of echo requests to send. " L7 w2 g+ d M- L6 p5 @$ C
! M: f G- L" ]7 ~7 P. V3 n% U& J
发送count指定的Echo数据包数。
3 E6 @6 w* D7 O ' [8 K3 b1 e2 J$ B
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) t' I0 \6 q4 F p3 ]4 p ' d, C6 ?; C3 y' b
C:\>ping -n 50 202.103.96.68
* Q9 b6 F# u& D$ Q
) T# _/ \2 X. ]; W3 t J) Q( } Pinging 202.103.96.68 with 32 bytes of data: 6 [9 Z# m& P, n2 X3 c4 b" h
- t) x; |" {* g) [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' B' [1 z$ r. C% h8 L* ]
Q7 _& @( [) C8 z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 P6 ~3 c, B/ \& r0 m
8 k8 c7 a8 r' F" d* c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 S$ q1 _7 D- M( B1 P3 S5 u* B: h
) h$ r0 p7 v7 @, [8 @0 W- l! z Request timed out.
7 P. @' X% N+ ~/ `. r * o. C# R l8 N5 R K, O
……………… " Q$ b+ x7 Z3 c: }. {% n
C5 `2 L& F+ b( e+ ?/ F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, g. M! K. q# O5 K+ Q1 R, e7 ^ 2 X9 H i" L3 K! h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
?' g. ~+ M. V i, s # ?; ~) ]# I$ B' K2 a4 m. Y3 s
Ping statistics for 202.103.96.68:
: z: c2 G# R( a. n- o
5 F, ?4 m. f& M) f7 e2 J/ V Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: + m$ z, {2 T) V+ q$ B! J9 A! {1 N7 \" v
+ M. E/ o& H8 `3 { Minimum = 40ms, Maximum = 51ms, Average = 46ms ) T8 k' }9 L% w
" {+ C: d/ V2 y5 a 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 / I; j- G9 k' i/ J5 E( @5 y
+ ^7 ^* \ u: b2 S9 J$ |" ` -l size Send buffer size. ' o: `' ~) E$ K! _* \" ]1 n/ |
. o6 |; Y* h) r$ G! D; t+ x
定义echo数据包大小。 |
|