|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, m& Y, _% F# {: M
! ]5 _: X( i, p( E* D8 c8 I 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: M& Z, K: a9 y' w) T' ?% {: }) V2 J
3 q& K6 A q# } q: L 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 * p% t/ W6 `1 m; g7 C2 R
3 P1 Q9 @/ Y/ [! t( R" P: p3 a Options: 8 g/ ~' m' V3 E; R x
% ^4 @0 Y4 H% z- r
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
: N# s& I0 f# J8 P2 F% }; U ! c5 v% P* |; J. S. Y$ H9 R m
不停的ping地方主机,直到你按下Control-C。
* O1 [# F" V7 E* y( F: s! T- o " p5 ?; |* Q" g% Y! w
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
( L1 g2 A9 Q5 d( w7 I1 l( A * W" u+ h l. N+ n( u: ]0 u4 N
-a Resolve addresses to hostnames. , {7 x) X" \! \7 _1 @
* I; N# x' K( a$ `7 h3 M* N5 U
解析计算机NetBios名。
4 W: ^, ], a3 \ N( a2 w4 p6 u
2 V/ c3 Q8 z" X7 i" u) z 示例:C:\>ping -a 192.168.1.21 , r- ^. y9 O) e- @
( _9 `5 o. P6 S. \ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
; ~6 m2 n6 \+ H4 E + T. U, K9 A. m1 ~. G' ?) h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, m9 {4 `" f y! T8 [ 8 g! o- w5 d9 }/ v+ ^6 C" h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 j0 ^- r4 h$ ~8 }, X
3 ]. [8 t7 M5 k0 q6 ^4 P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 u4 h% x& |" n* P. ~4 p0 l
# N! S: ?' s5 X# d, Q) H' ]* { \
5 w" P6 r# R7 u9 Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( D7 d2 \, J1 N, {& M
- q* M+ U8 ^ a2 ], T3 l/ W n Ping statistics for 192.168.1.21:
z# `0 q" z% P* J : t# k- _: Q! A0 [" g
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ I% {( t; K7 S / Z. f! D/ U1 n4 F$ F
Minimum = 0ms, Maximum = 0ms, Average = 0ms 6 n2 d, }; o. _1 c" T. g5 b) Z) D
! ~/ j# l/ A. E 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . M8 ?' c U- R$ C
+ v: t- _5 D, R( ?4 [5 r# o/ {
-n count Number of echo requests to send.
' M8 f( z# t4 p1 G ( g7 g, \% q3 \9 [" Q# b8 T
发送count指定的Echo数据包数。
* @+ d, \$ I u3 W' e
4 K% H) Q# D& I6 ^* }1 F7 N 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 z: v) b7 w0 q* R
, g1 d5 k9 a3 B6 p C:\>ping -n 50 202.103.96.68
/ |; j7 L& M4 u) v3 q
, ?8 Z7 ]* G0 C Pinging 202.103.96.68 with 32 bytes of data: 9 @0 z! X4 x; |
( `, |) u8 t% v; S3 M' S7 f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# N4 r/ j; S) Y1 {) Y
8 Q) x, A& H7 _5 g9 I* |; A! Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' o8 g0 d0 n1 A0 p' R. c
1 f/ j2 Y4 y* E; ~% y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ x- }: x" r% u# h$ }, L3 q
) Z" j) ]; |* F! d. M Request timed out. / G& J8 D' i# p4 p+ L, K' f
* L5 K& V! [6 Z, d }* e) o% O ………………
8 b2 Y u8 Q* g4 C! n2 D5 C: ? 3 M/ N1 b4 |% \1 Q* a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + ?, q4 ]- f; H. N8 `" n1 r1 h
( m9 q& E. R9 U6 i1 V1 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , i: F6 O' P# X! E# l
' F/ s) T6 U9 p3 W Ping statistics for 202.103.96.68:
9 @; ?7 U) y) c; R & M2 i: H& t9 E! G6 \
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
{; ~& w4 @2 Z' o) d
1 V$ K# G1 ]( X+ w; b0 b/ D7 z P6 l5 p, i Minimum = 40ms, Maximum = 51ms, Average = 46ms
4 k& l* V$ n) b s) D h- U& Z* J' |2 } ~
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 L) T; j2 r1 ]7 G0 g
: c9 ~0 W5 r* O' z -l size Send buffer size. / J1 f* b2 P, C7 H& B& p1 M
7 Z1 f( } d/ {. D" W7 e 定义echo数据包大小。 |
|