|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
5 D* G% z$ C m, d# X
2 h( [! B [2 [0 Z+ X( J& `& u 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ! j# }: z1 B3 @( Y% L- p* b
; k7 b4 ]+ A+ F) ] V- L$ m' s 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
/ s8 K0 w- t+ {; q& P( S1 r
9 t, C( N% G" @! @- T Options: 0 T2 f( g0 r7 @
% k* z! Y% c* Q U) @* ]
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ U, {# K1 n2 o. v4 g2 { ' w* N4 H5 T" L1 C+ D9 L/ J/ f+ Q0 x- D
不停的ping地方主机,直到你按下Control-C。
' u( k& m2 u8 U, ~+ W/ M4 u: j
; @3 d! W: e! e, U/ G: _& L' Y" f 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 " ^0 A% [, `5 q/ U+ U
; F! J2 z7 N8 r; r6 s8 F% z -a Resolve addresses to hostnames.
& k3 E- T3 h3 V5 \
* V; [0 m& i, E' l( Z 解析计算机NetBios名。 9 u# C5 |: u/ \, p
) N( `/ P$ I; O1 z5 y- r- Y; C
示例:C:\>ping -a 192.168.1.21
5 H4 K" L+ q1 Q5 y1 l) ^. B6 n 4 ^, [- j% W6 z w$ D q' d
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 ?9 ^1 C9 o2 U, T
8 Q$ o' H$ T/ l- B3 a6 ^) S; P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * r7 |4 B3 r2 ?* j. D/ K
4 ^/ {* e% z% H6 v( _$ ~0 t5 u( B
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' B* H9 n/ Q0 c4 [ + x7 H; T/ T' _+ m! y; [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( P( }+ z c% R3 n
$ o" I) T0 s7 e; p
. M3 D# a* Q% S# a$ `5 A Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: G0 R4 u0 N+ U9 f3 Z) C $ C/ H# l" U7 ?! h( N" Q
Ping statistics for 192.168.1.21: ! Y2 {. s' x& U4 G- H( f
% n9 F ?! @- G4 u% A# x Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 r; n3 x7 ]/ a& p2 d8 a
) d+ X% H! n j9 m o2 K( {0 i2 ?
Minimum = 0ms, Maximum = 0ms, Average = 0ms ! W: C( B0 W9 Z
! K9 L* D1 G3 x9 V7 p2 W I+ l 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . K* V G; q& r* R$ E5 c
0 @3 K8 L# Q \ L1 k. l+ d( r. c -n count Number of echo requests to send. " y/ P- f I9 F8 F2 C' X/ [
6 j8 [ N2 q) D& l5 F
发送count指定的Echo数据包数。
o: R( G0 q$ V; e5 j
% [2 H8 ]4 i% J/ f 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
9 Y0 U1 j1 E: p & ?' E0 G0 V3 Z1 {0 Z" }
C:\>ping -n 50 202.103.96.68 5 S$ M* z" _9 Q; ^. G3 X, ~
! ?- B! i2 O4 v- q6 g Pinging 202.103.96.68 with 32 bytes of data: " j" ?- m/ b; O+ }1 V# H
5 r0 A% P& A5 f% D: q- K Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ T8 h6 P- F. e$ b2 S ( }& @3 m: \/ A! j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 g& ]/ i6 `7 n1 L
5 C( P# M/ i( G, j; ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 ]3 _, n& z8 F/ ]' O7 m
$ d' o1 |. d% c: b. ]. Z
Request timed out.
" @1 s6 W3 k( x+ V, k 8 v- x! o; W9 x& `" L+ e
………………
- z$ A- a: K9 ^
9 r0 n$ b+ F( _9 G! A: O" a2 ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 r) [- h8 @# U+ L/ ^3 I4 A9 E* n6 n7 s
! a o: ?7 f% h& T% S; V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " P: i5 K) e+ o" x
P) q1 c# _' @$ v# U
Ping statistics for 202.103.96.68: & s+ Y, k ^* E6 P# d" B2 V
: f/ } o5 a) m7 n/ y& k4 W( v+ B Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( d' Z% J. j/ P m9 c1 |/ p9 I
0 g @" `# j8 q+ }: P2 Z
Minimum = 40ms, Maximum = 51ms, Average = 46ms % A1 ~: L& R/ k. r" G
% N# L5 [, s: q
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + H& @' _3 N& E" L& Z
4 }6 G+ |+ \; W. v6 M* o
-l size Send buffer size. ; B2 W0 V/ I; D$ u
8 e! A# d8 v X. d4 |3 _7 |0 o
定义echo数据包大小。 |
|