|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
# n$ j# `" v' F- O+ J , f! D& J- I( \
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, j/ G" l1 o" Y# T7 e$ ~
$ Y* W7 I( u; C' ^ 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
0 {0 ]3 w: L, U/ U9 D/ L3 `; ] F 5 T& v4 ]! c$ k; j' D6 N3 ]
Options: & f+ N, j8 f9 \: |; D4 a
2 o- x- t a$ w3 t3 o7 c3 r
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - [3 E& {* i7 F5 ^ K# s/ [8 w; f+ U
* p* V' }% B& I; f1 g
不停的ping地方主机,直到你按下Control-C。
9 z+ i2 N! l6 [$ m + w e& ~& T9 v# S& x# k6 m+ {9 Z; v
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
+ Y( U8 F- y- y7 i1 f* I [& c- B# R8 A
-a Resolve addresses to hostnames. % o, I+ F0 L. M& s7 I
* J0 t4 o$ b I4 p5 G
解析计算机NetBios名。 3 [3 o7 T* D+ l( E8 }5 M
- i4 y9 p7 a4 u 示例:C:\>ping -a 192.168.1.21
# J. V6 g- {1 W7 i8 p
* t( s9 {9 t7 H2 a1 S2 x: k- q Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ d) V, N* r$ u$ |! ?! ^
4 k* j6 K0 I/ ~. Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " w! W; I$ C, c6 X5 D4 q. ^6 p
0 Q1 W! j% p+ |# C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ Q6 b, U- _, E7 S' I# y
' o% g9 `$ z1 L/ K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; r/ m) t; S; O5 D2 ?# `* s' u H) G" s3 W/ h
9 H3 \% `$ q* i& Q7 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : t3 J* V! H) b; T3 z, m0 U7 S
. A# @- u. Q, E, { Ping statistics for 192.168.1.21: * c5 |# r1 N1 H( P
' ]0 b( D: A# V3 \* [$ U( v h4 r4 u
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# H- \2 f" e+ Q/ c( b: l : ~) [! E p7 s; e% D0 ?* ?+ J
Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 S+ E) a% r# Z4 G" j 8 I3 }' |; C' I
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
; r, w) D: ^/ {( z2 ^ ) C [2 e' [0 Y. |
-n count Number of echo requests to send. / X" h) O1 M: T
1 l J- J$ b/ ^$ V" Z1 B' d
发送count指定的Echo数据包数。
5 a. |% E+ E. Z9 a `6 E0 X! K- @& N% B! o
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 9 d6 N! s2 F$ I
' [! d( _" l! x C:\>ping -n 50 202.103.96.68 ) f# ?* _9 ^9 d- P9 D2 }
. o) c W/ E; [+ W. A3 @/ L* [
Pinging 202.103.96.68 with 32 bytes of data: ; u8 N9 I2 T4 c: X
( |+ ~0 x: W+ M3 Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 c' Y* u) z* b, N" [
& V3 m% O( _2 l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: a) E! n: L/ ]3 l
- @ F2 |- l2 B7 ]: m; @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( H |- }' H& ]" p* s+ S : Y4 T* b# I3 l
Request timed out. # e+ r9 R5 q8 Q0 n, m+ b( t6 y5 u
& P- [& A/ ?$ B( G+ g; x" L ……………… ' G8 m- }0 y& Y7 y
9 u i7 P7 a" I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 M3 ^7 f3 M' |4 s8 [! e$ _
# z2 ?! n; w5 I/ D+ t
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 D' y6 ]4 U* K' o' f1 j, k
6 R; s0 F+ y" D$ \: s Ping statistics for 202.103.96.68:
8 R9 w' D$ U. a& Q1 O/ j 1 U; X* P' u% X
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: " s) z8 J; P* Y9 N
6 `: q a+ W x8 E1 L9 g
Minimum = 40ms, Maximum = 51ms, Average = 46ms
* i' B, P7 t9 u' A# t8 L t/ Q
7 }- p8 Z- G; s2 E3 G' X 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + p' ^" W% ]" d) Z1 X# s* P! X
2 C, r6 q. V$ I1 [' Y6 m
-l size Send buffer size.
& Z4 j- u/ {! e2 Q8 O
: b7 `9 _" V0 W4 F 定义echo数据包大小。 |
|