  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % e' S7 }/ w9 { \0 e
c) V6 j+ A( q6 B/ b 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
3 g& C2 N5 Z, k/ g5 L4 e
; G B {* j% z% 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 ( {+ F0 D/ e, ~) {2 v4 f
& X7 b- L. Z* ~' U Options:
) n! h8 \( y, @ 1 a( q/ k( R0 Q3 _/ `0 x) U! q
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
; T, X1 S4 y# }4 j+ z
$ X. P- o& x2 @% z 不停的ping地方主机,直到你按下Control-C。
g5 d' t$ L. W / l4 |, Y) d# |1 s/ |3 ^
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ) g# Z) h5 W- K( E5 I$ M
) E% a1 h0 T$ F4 m8 Q -a Resolve addresses to hostnames.
0 [8 b/ e2 l) A! @
$ V, b* y7 b: [ 解析计算机NetBios名。 ! L' e. T1 ?: w
2 y' D3 e2 h# N/ n# @6 x. S$ {; A3 X 示例:C:\>ping -a 192.168.1.21 & g! b, P1 c: X; D- y p5 T
0 a+ [$ {; h& z8 j+ T5 R" B Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. t& \* n2 Z* M" ?6 } 8 X+ r# z# {7 t$ n i9 Q0 Y9 h6 L& Z! y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( U+ l+ T4 R- Q! ^* g
1 R( ~' h% x7 \6 f& e. _* T1 e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 Y5 S j- o% I, R3 O# |9 [* N
; y( R& M2 J2 Z6 m+ t6 T | Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( h$ ]/ x% d: @( S3 k
" F. R1 g: F* |4 A9 P' S G% ?5 _% E J+ E1 L4 V# `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 ^1 }+ V$ l& x2 h! y ` ; G0 B: v; T; {* L, i) E
Ping statistics for 192.168.1.21:
5 G& ~# ]' M) T, h 4 }# c. F: ~4 S% G- h+ L! L! s8 L ?
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
- k% B4 u& V0 w6 ]& E2 r 6 s" h/ }) d5 W
Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 H+ g3 ?- F: N4 T2 H
7 [ Z7 l7 v, y) y. U% D 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
7 F" {" X" l# ]; R 7 p* k$ ~) Q) g2 w
-n count Number of echo requests to send. + ]2 c( _" w# [- g" H+ l S9 w0 ~+ Y
! }, W8 L0 ^) O+ o6 {0 b 发送count指定的Echo数据包数。 / }6 N. m) p% q+ N% m9 z. v
7 {, y9 \0 \* m, z" c; `
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 E: [, u- M& c# e3 ?: B # |: P& I: T& o, u( W
C:\>ping -n 50 202.103.96.68 f# M" Z* t. z6 J# P; N4 A
* r; C6 a2 g% P8 E Pinging 202.103.96.68 with 32 bytes of data: ( Z" t, K& m5 a2 B# D( w! }
/ G3 z# S) G5 m* I L' z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; d, J; w1 g. B( Z* p+ |$ d 1 c( e2 ^/ g9 H6 Q7 E, }% N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) {- O/ `: v- b- H/ U3 U. f$ W
- G' H9 t3 M+ ^3 E V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; z( \; l3 L/ }( z
' H% r1 |" `% F
Request timed out. 0 ^: h5 _( q9 H' ~3 w: u
0 D a r: j; ^; P5 j5 e
……………… " K [$ H8 |( f# [" [' G
) S7 `& s7 F; s% j3 D/ r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! {: w: z. T) h" q4 ?# o. ?( ] 3 `7 t' \+ ~' e4 q! r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 {" |- k6 p `
0 o) r8 t$ u M0 D Ping statistics for 202.103.96.68:
1 W) Q4 b ?% y/ b# ?5 @
( h7 D9 H5 F9 a. h. H3 w' L Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" Y1 z# u9 X: a) e! w6 B u+ u: H; u8 x
Minimum = 40ms, Maximum = 51ms, Average = 46ms
% L& U) N( m* w7 l
- I; F4 ^! ]3 I0 b9 ? 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 1 i- M. T/ B G8 k" F; }
2 P$ U0 J4 P" H& I( J# T -l size Send buffer size.
3 [9 A; {, |6 \1 U, B& I5 Q: s& Z : _) @+ ]# r8 d* e3 y& k7 O% }
定义echo数据包大小。 |
|