|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 . E6 o) \" Z5 `+ y/ p. Y
0 K! K ~1 u" H, `8 \& \" E8 L0 B
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ x# d4 b0 w+ ]; ]$ W 6 [1 v. g3 b2 Y6 X& K; K. h, n! g
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 l. X, Y& L+ o+ c: I/ u$ ~: } 6 `- d3 l8 t* k/ L/ j. T3 s4 v
Options: + z" p$ l4 s* R+ g( p$ Z; B
; e5 T$ B) F u
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 9 s* `, g& e) m( L. \7 L
# y4 C# p( G( {+ a' T& y
不停的ping地方主机,直到你按下Control-C。
& x8 ], l4 o: Y# `6 u, b + o+ J. p! I. ?; X% \
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( b- H9 P+ b& {! V" f
, l d, Z7 N! C4 O% g9 U d5 Z -a Resolve addresses to hostnames.
0 L# o. o% i8 B, q; E6 ^ 8 D* Q2 F/ U, A& ?0 |
解析计算机NetBios名。
, A# e& R. o' ~
% @1 B2 s% q9 p+ o 示例:C:\>ping -a 192.168.1.21
; M" _) I& i+ X9 a6 t6 J 9 g3 {) h _( l3 X8 | }9 i6 \3 a
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
, Z- M- w: M& p# v
6 B9 H* [0 e+ w. N8 c0 s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 v) c6 d; b% o" f8 G5 [
% A+ P/ v9 E' c, l9 `+ s6 A/ f2 [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; z) Q0 a& e7 Y) Y; L
, Q7 m8 T6 N5 v3 F; D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + W9 }+ \$ S2 C; R
* S% u% i" @% K# \! M
# G" ?2 ~( k6 k% y' N& f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ [8 J3 }* a. J% p9 W' @+ s
( I; U" f3 z1 t d$ y" f' ] o% Y Ping statistics for 192.168.1.21: ) W+ u0 d! m" _+ _
) S" Q" i* `6 Y2 y0 ~
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # x; A. b+ T6 R G) k
/ N/ D5 i; q: S9 R% V Minimum = 0ms, Maximum = 0ms, Average = 0ms
$ h' i, w) W q# g3 o2 p
( `8 D0 p% L5 j) q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 2 q6 o, {% w) O3 g+ X2 ~5 V
# g- Y) F8 h: A2 Q -n count Number of echo requests to send.
5 L* e) F! l" N; ^ ; q3 i6 }# ~; A) ?# [& c) c
发送count指定的Echo数据包数。
1 W# |7 W5 w( R3 I! D ( G6 }0 H4 M, R/ z8 s
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
9 j0 e$ t3 w% f6 L/ y& H/ ^ o5 B
4 w$ P+ O5 D" V9 P j' b6 q C:\>ping -n 50 202.103.96.68
+ G, `# L0 q* z( t+ R( a
: v1 j2 Q4 z9 q% J; Z& A. I Pinging 202.103.96.68 with 32 bytes of data: " \ {) A! v! ~" e7 r
, ^' \* x8 U4 M6 u4 C9 v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' j H! ?1 D: e4 { t- g" B
1 w2 u$ a1 y& u q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " s+ B, M6 v k. ]& z
7 T4 b: q5 R7 a, t* b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 y5 }7 | ^( B7 Y* b
/ V4 o8 C1 f# j3 |) h- h# a; s Request timed out.
4 R1 u8 e3 e6 l+ V" a* S & h2 q- @" i6 ~6 i. D0 y
………………
6 P0 X7 b: Y; A( Q; \9 i
7 S- |: Z s3 H' }( }- ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 v8 M0 Q+ Q1 \# e! M - K) ^4 V m& ?" L( e }0 y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( g) o7 h% _ Q" {3 S2 Q1 |
- y( Q8 x$ K e( c3 R# B
Ping statistics for 202.103.96.68:
( f& B7 \4 D% ~4 `$ ]
: ^ q/ L9 U. j9 q6 s# Z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 s( Z0 B+ G( D$ W- A L5 L
- k8 }+ \& w `& |! X Minimum = 40ms, Maximum = 51ms, Average = 46ms
k) Y) E: x3 P
) E8 I' B6 X( n/ W) a; R 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 H. M( P9 }7 @% _ % @, l( Y+ u# b" o0 e* A( o
-l size Send buffer size. 1 z7 L6 G) g0 `
% d( I' i3 d* h7 B- M 定义echo数据包大小。 |
|