  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 / H; l) j3 B- q1 c
5 m: |4 [) H- ^1 a& K 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
% W9 w3 w& Z1 Z! w% \; p
% }( R% ^ ^& R4 [0 {5 N 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 9 [* t5 H% ?5 b; E. ~ i r$ e
: o" k+ Y" n5 S3 I+ f
Options:
4 b c3 z( |1 d. @, {. B- v
5 x. d1 B8 i1 Z3 j -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
" L: F7 e/ E% s
; v4 d; x! O) u2 P+ f x, G; s 不停的ping地方主机,直到你按下Control-C。 ' T0 S* ~+ e3 H. E( V
$ d; w2 e. q" ^. k2 _
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( T! N3 @4 _2 x3 R" F1 L
# ^" m3 v$ a- _7 v: u -a Resolve addresses to hostnames. : ]& @& r" \1 i' O0 V
( P: \4 v4 m3 o2 B# P& }
解析计算机NetBios名。
* C) E! m; T; g* p! ?( H
S! Q8 H* U9 D5 f* o7 P 示例:C:\>ping -a 192.168.1.21 ! S) C& X8 i( L c3 ?% q
3 C' v9 P; F# u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: + h$ s: ^0 n& ], g
r$ v$ x! j# l' ^4 v7 K
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. `* d1 c& O2 o+ U
# |4 q5 @! b" c4 P* L% d2 w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; D9 A* h) T8 @ ) J6 I, m" j' u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 Z% u1 w; ^( a4 [8 d, k3 s6 ?# n B" M, D
: r4 ]" A2 O( ]. {0 G1 E+ s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
b# x# Z& L& F! h. U; U2 @9 N ( s+ Z% [! l. W: ]/ ~
Ping statistics for 192.168.1.21:
- I0 T$ f v' k) [
# b7 Y% P6 ^2 R8 E. h# H+ m8 h0 n Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
! O) Z9 _/ ]9 B7 j0 o+ P& ~, Z 2 e, \3 \: ?" l7 ?3 Z" u
Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 n% B! G; }- C. e5 C$ ]
# b H+ z1 s7 |# W5 y1 m 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 % s; h4 |& q9 |$ j" n
, l- b1 _5 b, k: k$ V' Z -n count Number of echo requests to send. 6 a6 v* d% ~8 v3 S; ]6 g
3 w) Z% U% { `9 c8 r 发送count指定的Echo数据包数。 - H$ W( `% M/ B6 m+ T% \3 d
t: v$ {3 P' m- N: O$ c
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
+ l- |4 h! P5 {; E$ x
: Q/ j, F/ Q; D; M! w$ i1 P C:\>ping -n 50 202.103.96.68
' u. K% y9 f9 ]! y- C
3 Q) k8 @1 b9 {' V' D Pinging 202.103.96.68 with 32 bytes of data: 8 m0 V: N5 A' g8 H: V: Y
2 Z& L3 B$ P/ c4 S3 k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 S! Y' M. ~: F$ ?
! _2 l5 [& e7 L: F+ ]2 O8 {% O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % |) T3 `# X% c
! O0 L4 q$ } b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) A* K8 t) ?9 _7 f
2 Q- e. I D" |3 ^5 ~) ~
Request timed out.
h U0 M/ Z# a& l& [- P
: |& ?7 t; y- ^) y/ N: l6 n1 i+ Q ………………
' B8 |5 s/ n* p ( N3 B# e- ~" G# t, ^5 ^
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, p1 a0 C* w; A$ \4 Z$ l
) J2 v- l4 H% N+ D' O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' F* L% r! A/ ^7 C# \; W* l
- a! K4 a( o# ^7 L. x: a
Ping statistics for 202.103.96.68:
+ [! I3 b9 O$ I m) V* _ H
3 i& c; F: o$ D) T2 C8 U/ _" I Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 w5 ~8 ~6 U6 U9 i% {
' z& o" U- Z& S% ? Minimum = 40ms, Maximum = 51ms, Average = 46ms
+ Q1 L; n5 ?; H% i 2 D4 I4 b* Z6 V) C" V% U
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ e/ p( o# t! l3 `5 x 5 i7 F8 y. }% k o
-l size Send buffer size. , n: A0 z- O! f( T
3 ]# k* E6 T$ t; R* q6 ^ 定义echo数据包大小。 |
|