  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 h+ {. N9 Y) F! o* O3 j
, B, f" t/ C* @0 K
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ M" N/ T' @; `1 B' |# M# Q
f1 C: I' J- [; X1 e; |8 R 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 1 _" m% e, q+ T' P/ K
' p8 `* l0 z4 D Options:
* `7 l7 @) y; [, z, m / W( U* b7 @( p* ?9 @- z; L
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. : q( N, k" S" a, Z" Q. W8 j: r' X0 M
2 o" ^ `" w4 K l. X" p+ s* O
不停的ping地方主机,直到你按下Control-C。
6 ]( O/ [# l5 v- w# [" U
$ N. [" |% E1 ^) H% m 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 Y J+ o. n1 a2 P+ L8 [; r9 T
4 D% n9 X6 k9 P" T
-a Resolve addresses to hostnames.
) C7 e8 m, o1 G; }4 f% f p5 R
# e2 I" ^: x3 \7 O" _0 U 解析计算机NetBios名。
) d9 Y* [1 Q, B$ z& C : ~% f, ^9 T# @# ]3 S% l0 w$ h
示例:C:\>ping -a 192.168.1.21 3 F) {) _7 ?& ~" K$ A
* W7 K' D+ g) C/ E: R
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 J2 V# D1 P. v: j4 ]
# }! y1 q# k5 }2 h1 E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 I7 N& I; X! ~: R0 w ' K2 a& e- s# `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: Z7 Q$ D+ C9 [6 r
! m* M0 @5 T' [/ X! v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 O7 g3 q( H7 q5 T( _% A! O" f
# J3 X8 |/ J+ Y/ p; L$ Q$ o
" t7 }* s9 k. S* D+ h( `+ T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 a" a' J& c4 s1 x$ \7 o9 l% l
k2 P8 e6 s+ b9 ~
Ping statistics for 192.168.1.21:
5 E0 G. K( l0 S/ @& z* D: f , o# w2 S: \' m5 D1 X- \6 X4 x0 H
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + z6 p+ f( S' b3 |+ s
# \( k! S, Q2 h2 D- P
Minimum = 0ms, Maximum = 0ms, Average = 0ms * G' h9 g. M! A L* ?' c
- d; h7 D# c' W" ^% r8 p1 q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 3 Z( G! c) D" V" }0 ?) K' x
0 N8 Q- h$ h- z& x$ Q; G
-n count Number of echo requests to send.
' p! n9 l A; o9 t
) p+ W# x2 E; x# I! G$ ^ 发送count指定的Echo数据包数。
! G5 \5 K: L' s0 U5 N+ @$ }
. P0 {( H9 U8 T% u 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
1 q/ i. o% i y: x) T
* j K, ^4 z. T' z% E3 X C:\>ping -n 50 202.103.96.68
7 C" h9 Q; Z; U& X) U4 c
+ s! }0 j% g8 b: H& s Pinging 202.103.96.68 with 32 bytes of data:
2 g: B( m0 S$ ]2 }. x+ k 5 B: t4 }# x. S# C* U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 P( D- }: u7 [* u( c. J8 E# a
1 k9 z0 A# ]/ J5 H# S }0 ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' O& i+ j: Z" ?3 M2 ]! s0 J
5 o U+ t% _; o. s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ g; L( b5 k q- n" u
8 r& f0 N" `& N/ U0 Z Request timed out.
- q d8 \( j0 [3 k u9 }
' L# e% ^4 [2 Y3 ~8 `$ Z ………………
8 w& {/ I$ Y( M a7 D* f' X* h
; q/ C! _$ ^4 L; x- { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; u' P6 a: s H
/ I# i _, H% T# k( q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( a/ r; c! t" q; r$ @4 s
) m1 v" _2 J2 v& M" g Ping statistics for 202.103.96.68: 1 M% i( g; J+ n, U
6 _9 {/ t x6 Z- F- k7 ?/ b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - H$ l' s; W" X$ U( m5 q
- o3 Q) g8 z7 e' D4 j/ e, U3 P
Minimum = 40ms, Maximum = 51ms, Average = 46ms % \! V3 L2 L* J
* ^) M! q, e1 }
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ) ?: c6 v/ n: y0 I% K3 F: I
; {' _6 q, A3 b `+ ]. P+ P
-l size Send buffer size.
, Q3 n$ t6 M! w6 J
8 M! N; C" h1 E 定义echo数据包大小。 |
|