|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
) X+ W& t; G+ u# i" K( `, p 6 K# L3 C* o/ ]8 w* F- ?
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 y! U- l/ V, n2 u1 o- x
9 I/ S3 |3 ~/ V( W" Z0 c( Y0 x 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 ' j1 v; ]0 |4 l9 H
. U8 q/ y3 s. j+ s% {4 `
Options:
4 a7 j% t' ~( {
+ R& @; ^9 x& u( h. }/ w! {0 P( \, k -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 Z* i& r3 H* N5 e
/ m5 `! f3 v5 A$ E 不停的ping地方主机,直到你按下Control-C。
- ]5 L# V6 I# _* V" y3 [; K3 B . f3 A: c$ }5 n, m3 | |
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
- X1 w' J8 d t. X; h
1 a: E7 A1 w0 C7 A6 A5 F- H/ X -a Resolve addresses to hostnames.
0 K3 L7 I% S( i# t2 h
) X2 v% D9 z) s$ m 解析计算机NetBios名。 0 f4 \( `. M# ?: r& j) L; x
! b% E) O# b4 n6 L
示例:C:\>ping -a 192.168.1.21 $ a/ T, P3 C, h& H# G
5 H. J, G' B6 ^ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 _6 X5 U, o5 x; W7 |& c7 l, f5 N+ ^ ( ]9 ^# ~, b/ V8 S- ^8 @) p, f& m8 ~- U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' ^/ ]. ?6 f0 n6 z) L
" [( E! a. s* ^, g u {( O6 u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% E1 {4 J% f; }+ P3 K $ N' G' O5 Y, P( [1 X
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( {) P, [! x; i2 Q0 K* O; @$ \
" v. P. Y4 \+ D' b2 r' A _) E$ y8 z" g( C9 w8 Q, r: }, q, n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 g6 M' g, w& ]2 R
' ~% w* L5 `0 H2 A6 G, o; j9 U
Ping statistics for 192.168.1.21:
% [ G0 K1 @/ `2 r% T3 l
& a n- Q& @; R( x4 h Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 0 v% |! U# i& p0 ?
; h5 U, J' x. }5 ?+ u
Minimum = 0ms, Maximum = 0ms, Average = 0ms
/ e5 N( y( t( a" H ; y6 \3 D5 a! m- K+ G
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
, i9 v; c7 v+ F. e: J0 U 5 @. Z2 d& X+ x! L0 \$ m4 E
-n count Number of echo requests to send. $ D/ `4 B7 z7 L6 g
4 |% G( p" F/ e8 e; B' O
发送count指定的Echo数据包数。
" ^9 z9 S* b' ? " h8 W: `" P7 g6 @7 h+ L" P1 M
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: + d, ]: O1 b, Y2 i
9 U g& N6 Z- e" r* p# J5 K
C:\>ping -n 50 202.103.96.68 # l4 b. Q4 n8 _8 O) i
7 M. U+ _7 W% B: H, m; B, d Pinging 202.103.96.68 with 32 bytes of data: 3 i" c% p- x+ {2 e$ e0 R/ _
# G& D. z3 X9 H9 Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 L# Z7 {! g( U1 @0 ?- Y
/ X- D; g& Q* {. h0 J: l% N: b. y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " V1 V2 @4 t, v# T# b" W
/ V- k0 ]3 I+ n4 Z' W" M6 V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
K0 D. @* L, A# N- s1 h 1 o2 ^ F$ e3 N- P- V% h! Q
Request timed out.
% [/ C8 i& O0 ?) k
/ U* a9 ~- a2 Q2 `: I1 _ ……………… ( \' W4 O) B* _' S7 a
. ~2 U' W- J5 N8 w; @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( K7 f# m- _1 ?$ U* ^
. S T' P- p6 N0 I/ \ ` Z4 |# r% M* ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 R8 R. Z- s" } 6 n" V7 d% `# B# h3 O. I+ u( s
Ping statistics for 202.103.96.68: ' B( t0 O3 ~5 K( S' s' `: R
' ^$ ~: K, G: v \" h/ B0 [ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 3 k+ X1 {+ f' r
0 M5 A5 l5 h S1 H) m" [ Minimum = 40ms, Maximum = 51ms, Average = 46ms
( W, u( A9 R5 M1 Y" R [. ?; P, ?, v" L0 }+ C% \, C
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 5 k$ A" [4 V$ Y* x
$ L6 M$ q Z9 v; c" }3 c3 F: W8 j -l size Send buffer size. ' T Q6 q4 F, l% [$ `* K( ?, a
2 X0 C' u) H8 E3 A& I5 |# B 定义echo数据包大小。 |
|