|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ h4 u$ F+ C/ V8 ?! g& \
( ~% j7 B b8 J, ?$ C( C/ n% ?4 f 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
0 [" V- p: k! t8 c \
# d) E4 y+ f% E 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 3 t( O0 x# K; S& y# |& _( ~4 w
3 F9 Q8 }; C. f& d2 L Options: & t9 X9 E# F O% T- v( S8 c
3 f, j& |6 s; F( h* l8 U
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) O$ R2 I" b2 Y
' A; s: @1 v% K7 n4 E G0 K4 M 不停的ping地方主机,直到你按下Control-C。 . n S0 `8 s; e7 w0 _
8 ]4 I% c) t" X1 a' ` d0 p C
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 2 H7 f# Y- ], d% J& }
: |. @ M# {3 I; C -a Resolve addresses to hostnames.
/ V" }0 O8 ^6 _) K M9 G' V- S. s9 w
解析计算机NetBios名。
* j/ v+ h6 f6 h 3 X) n' I* ^" w5 ~& K
示例:C:\>ping -a 192.168.1.21
& M/ Y5 h$ H4 F+ t% q5 b& {
& u; P- a& a# }4 A5 v3 u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
2 d5 M% F2 b! R; Z8 \2 q4 k 4 V- { f4 M( M1 k" p( H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- `, Q1 @! @% s- Y) L " E; \; c) n& i' j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 R9 r3 e8 x9 E# F. s' \
' S* U* W0 I6 h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & l) |; P( Q1 l' _* ^* O3 `: A
2 _8 v& C; x2 _9 i6 r) l
+ n/ W3 }# a; r- h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- L/ D/ R: P1 T& z9 _0 |/ u 8 p* l: E7 E6 t8 C7 t2 K
Ping statistics for 192.168.1.21: " Z g- N2 k4 _
+ ]. I0 [4 q, U Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ' p; m4 u& j6 d' ?4 m8 X
, [* h2 t3 i5 j5 o5 l4 b: A: \8 A
Minimum = 0ms, Maximum = 0ms, Average = 0ms ! A2 C1 ^: J, w+ T
) w6 e) S- |& `, b
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
0 i- v/ {9 o/ b# Z 9 t/ b3 H5 R, m* k
-n count Number of echo requests to send. ! [" ]7 s4 o% r- I
) ?$ b$ h, _$ f$ u
发送count指定的Echo数据包数。
+ u5 z5 ]9 g% W1 e3 t9 N 9 s# b; z8 q3 Y4 @
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
" a- D1 H S3 I2 @ x4 N
" t! s4 D% a& r C:\>ping -n 50 202.103.96.68 3 o4 q, g- j; Q4 f# X v4 a
0 k$ L9 [; m V# \: }6 b9 ]
Pinging 202.103.96.68 with 32 bytes of data: , p! q, z9 C& g
3 I, K6 f2 B5 i, h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 S+ g q9 A/ ^1 _/ C! B
! d. ^( A G; ~ j6 @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) J4 {4 D4 {: e( q3 u ; T- l+ q( @0 n: K7 ?* _' k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: ?( [" X! D: R5 y5 S+ a
& f4 t3 L( a# E$ d/ I7 d Request timed out.
% s0 e" Q9 o- G9 w / \/ F. n. X" i/ b! z& p+ M9 t
………………
" z$ I& |0 g# E8 O- U / P7 b% r6 i4 Z4 ]7 S# g. Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 n4 D- W+ W( t+ z. L
E$ I8 e, R9 u5 S* O& v/ q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * _& E; t- p) I
0 M6 K# Y n: K. p) ?3 _ Ping statistics for 202.103.96.68: 6 V8 X2 B9 k: S- D5 |; Z
0 K* ?# ~3 S% A" \$ v
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
- B4 q2 O" _ @2 ] 0 O4 Q' U& f8 [2 L
Minimum = 40ms, Maximum = 51ms, Average = 46ms 5 i8 j& n# F- _
$ @3 R7 a! o+ p1 b: c2 ~' m
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 ?( f. c& g* b. K
0 \; k6 E( U8 _ -l size Send buffer size.
9 u% O* I" d6 A% W! w4 ^9 C
6 R! C. y- z/ k4 r4 P, G- b4 z- i+ J 定义echo数据包大小。 |
|