|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
. }% g. A, H/ M' R" h
* z- H. w9 {2 X( S 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
: ]$ i( t* |& E 8 @$ |1 t( c8 D5 X: v) ~
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
2 y$ C1 Y$ `: {7 J L0 T9 a( k
w6 C7 M& n- x: W w$ ]4 R Options:
! c7 y5 y& Z$ L5 |( B- T
# {7 N$ L& O+ M. v -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. f* D# e0 l* ^( n4 m% B4 l
0 r9 G3 r/ h" V3 M, l 不停的ping地方主机,直到你按下Control-C。
. z6 y9 {. D S5 Z) [9 _# d
' G' h! |6 ]- |% U. U 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & V+ f- C; p+ A* F5 t2 M0 \1 `! \
( n) j: G" T% J9 n -a Resolve addresses to hostnames.
: D7 D) b8 Y& H/ [% W) v 9 n* K8 L9 q; k, c
解析计算机NetBios名。
5 r; C5 k7 _: C# H7 e* K
! \' ]" Z0 c3 O0 X 示例:C:\>ping -a 192.168.1.21 , l6 e" [; I& k b; h$ b# Z
5 J4 G* z8 r& I, H# }$ E0 R4 k Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ' L9 X' V5 u5 A8 Z
: p s6 z C w, V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " H& l3 R) Z% A0 l
: y q9 [( I0 [+ b- C/ b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 u' m6 P3 {; n) _ Z
B% @& x$ h4 }
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 s X2 r) b5 G5 R' l1 I( o% v8 e: I3 r& C5 X: r( u2 ?
* n: q2 ]; d8 U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) G9 ?6 Z: d# `! \
1 x' c7 V: m9 f+ y+ M
Ping statistics for 192.168.1.21: , u* I* k0 V+ ?8 R
0 c2 j& Y [) _% y# A5 I
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; o3 c! } J- u0 Q* Q, F
' J8 h& N. _/ a) S1 d( ] Minimum = 0ms, Maximum = 0ms, Average = 0ms ) B4 D( d. z9 \6 _' J
0 U* }2 Q( b* f# f9 f
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. v$ j+ C3 E8 }
% E+ b9 L# @8 b$ ] -n count Number of echo requests to send. * J3 Z! w5 \ d
" b x0 v' d5 Y! a
发送count指定的Echo数据包数。
$ l4 b& a9 L1 `
# V# h( X' K# B4 S( |+ R 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* s6 p5 E' P- G3 F7 |7 T) T 8 p3 d: n. e: @/ d5 }( v
C:\>ping -n 50 202.103.96.68 4 [$ g& a% d+ B& j. T
# K k! i( l1 x- t$ G1 L K
Pinging 202.103.96.68 with 32 bytes of data:
" f, T0 @ K+ }( p5 N: j/ C " Z$ G2 l) u( [2 }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 S3 |( t; b7 x3 {
I" h0 [4 A/ Q( _9 I! n0 x$ j1 m6 } Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; b a7 d1 u s% ^2 X7 B3 x
) J9 e2 r( g# ]5 s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / V2 [" j+ ]9 V. l$ V3 G4 S
: u3 x3 a4 _8 @% F: }1 a
Request timed out.
: A: K% ~) Q$ _# z 8 v& ^* Q" t1 j" [- b2 k% ^# f% ~
………………
- A2 V6 j4 i) ~* q) [ . R" c. u7 l! b/ u& c: e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- `# z/ K# F2 v( \ p& s7 ^& l" n
8 r, Q! ?! y# ?* W% `7 t2 |4 j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / z# y2 j+ S- P. R& g
1 V) \ p! c" {: k) F Ping statistics for 202.103.96.68:
4 G+ I' H: y: |7 \6 R7 ?) l. b 2 ?1 L0 x$ [! K$ z
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: $ U7 c Y! A" G! t x
6 Y% H5 [+ J( B Minimum = 40ms, Maximum = 51ms, Average = 46ms
0 }" U8 D8 ~3 j9 d/ i' _- z
; C* W! ?% ?+ K: k 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 g- m) \1 a4 x$ W
; B, E+ b/ p4 e/ c -l size Send buffer size. 1 w) ]/ f- Q& M) w$ `
% a' t. {' b7 c% w4 x
定义echo数据包大小。 |
|