|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
( j" _8 x2 z6 a/ d t( x & C' o+ y/ J7 V
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# T$ B4 ~, R. G( W' |# ^
u( J5 W* n: M2 o 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
( C/ M8 q3 n$ ~* Y
* s6 @) u2 O" W- H$ y( A Options:
. Y# q6 o$ l B+ k; f + y7 q7 G* Z# \2 p! f
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ X5 E3 K! y! ?+ P# x. ~' V
; L8 x1 S' u [ 不停的ping地方主机,直到你按下Control-C。
1 l' `; N. Y( ]1 A + D- K8 j$ H6 C" D+ [$ W! w
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 - F6 r& r; K# Q. l
' t: E; y7 j/ s0 @& p -a Resolve addresses to hostnames. 3 W+ H" w( s1 R/ r& R
5 {3 k- c: K& p+ K3 |, k* x
解析计算机NetBios名。
( _2 I ~8 t' E& L: K: {; L
- h' E" G& E# x2 H9 c3 B1 d 示例:C:\>ping -a 192.168.1.21
/ G7 R* r6 i! e. T! W6 ]4 [- z
( d0 P; G% T+ i* ^& c m( u* ^ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: - Z" U U/ H8 [( e& }8 A" V
8 [# z! A) G# V+ u3 v( D; Q6 L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 n$ @4 X' ~1 k5 G' H, P6 \$ ?
" H9 N$ h2 G- y. x1 ?: A$ R1 w! j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ ?5 \2 n. X) G( x' U5 n! a R/ `4 ]
" P# \4 N: ?0 R$ i0 T7 @9 {# h Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! N3 m" W: f2 z6 [) E4 `& k# k' w, `7 [+ h8 m [+ W
( Z1 g/ S9 a% k! w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / J5 a5 H% Q" [) [" K1 L" K
' o J: _' }# U' s( r$ @! G8 X Ping statistics for 192.168.1.21:
$ w) }% Y. s; K m $ l! H; K$ w( M$ g% Z, l. g
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
6 ~$ S6 N' n5 I' r9 p: x
+ e$ Z4 _8 u# k7 Q Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 K$ O ]9 |$ D& }
% B4 b' w+ |" F
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 y3 }, D4 Q; y2 T( V6 c# [3 L0 k
+ E2 D6 X8 D, R' B4 P
-n count Number of echo requests to send. 1 q& r1 c8 A% b
R+ P) @# G; Y$ [6 I6 z* U! j 发送count指定的Echo数据包数。 H0 x( q8 [: Q$ q
) H4 e! N' h: r. X9 ~; B" g) M 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 z- e0 b- K4 q. y0 u% H4 d, g 6 ^" U1 `1 C* ~
C:\>ping -n 50 202.103.96.68 * x* K5 F6 _* l3 X: K' M( p
6 ~+ A& `+ e" |% x- y3 u! V) Q: K& M
Pinging 202.103.96.68 with 32 bytes of data:
5 c+ V, ~1 T$ i" M( N8 Z) k . P3 ?5 p( S, C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - O: }- Y4 g" b
+ t/ n! E. C+ I2 Y3 C [7 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 D+ N7 i; R/ U2 | J: j
, j9 k& |' d# ^ q5 k0 @) W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " i3 z* x$ ?& q* n @ Y
) M! |% Y8 p8 s8 s
Request timed out. 1 @/ j0 B, L) }6 c" ?
2 `1 s/ a/ L* |% c. ~& B R; K
………………
5 U+ m# o! U+ b: f1 M5 r- x
6 y/ G( J. R7 h w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / j) Z2 l6 d/ j
4 E/ B9 c) H7 a& Y# B; R+ x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; O. G8 U8 A, w1 g( |9 L/ c$ d0 Q: u 8 W' }; ]+ _8 v
Ping statistics for 202.103.96.68:
. E3 M, |$ z2 i: G; A
% o( }; T' u/ H, N8 `9 F Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
; t8 j6 S. y; S& p# g - L$ D0 N7 e% \: z f" X& s' U5 n+ L
Minimum = 40ms, Maximum = 51ms, Average = 46ms
& w* j9 S+ O4 P5 N- W5 a; r 9 W# O; _ u/ j0 b
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& x6 k( e, R0 q) W
' M, a0 i7 ] l) n" k( [ -l size Send buffer size.
2 A, g6 M7 M' c
4 D: \* e. t* h7 a8 M- t+ i7 b 定义echo数据包大小。 |
|