|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 }/ Z2 z1 H" _7 a- F9 @
, k( B2 }' K6 c1 ]/ ^
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
W1 W- r {: v2 C) E2 f
* j8 i3 W' c* R, J5 }& }1 y% e2 l( [ 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 , z) l% q; ?3 |8 a& Q
1 ?% u8 _8 }: K" t J
Options:
+ H1 x+ {% B- p. V. @: r
& X( d% \: ^+ h; L2 D) i* l# X( p! z -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 6 p) f7 ]$ I: j! M
0 S+ q) c0 |# x) O
不停的ping地方主机,直到你按下Control-C。
4 L4 d1 G# g$ V, J
2 I5 j* l5 J" y7 S2 Z6 G! c 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 , k, `" \2 v1 |9 `$ ^
5 D, p2 a, Q3 Q: w7 H0 w! c -a Resolve addresses to hostnames.
E+ ^2 p" V( z" z2 @6 m/ z* l' N
9 u( y# c; k; J; h2 c1 p- a# r 解析计算机NetBios名。
& \ Y( j% v! y4 r) i
4 ^* W3 W( i7 H1 m/ V9 L1 G& J* p, I 示例:C:\>ping -a 192.168.1.21 ( b- R' m% B5 ?/ `+ l" ~) Q4 \8 z
5 B; ?, v' V; }4 { Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
4 B! Y; Z' k# T / B+ n- ]) u* K/ g. b
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) A5 o/ Z9 ~' Q Z
: t# U7 z6 ?; o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : A0 o! p6 }4 t9 l8 a% s
( o. N Z1 {" U: T: N: q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % f; R$ }; q) B
/ j Z) ^( n0 x; E: L / r% S* k$ s$ c% ?+ M4 c! z2 H
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' Y9 T3 e2 b: z' A- m, X5 Q- r7 Y9 O 8 b- l! e2 Q0 B! D9 [
Ping statistics for 192.168.1.21:
$ ~' o, i) ^. P0 r s+ |% c6 T 0 y- Z( \ H# A& G+ ?
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: & a4 L7 \7 d: `
3 s3 i G" u7 L. a- l' e5 @; H8 k, m
Minimum = 0ms, Maximum = 0ms, Average = 0ms
% X4 _ D& M% Q3 t8 I( Y2 o 2 q" i4 Y0 W9 Q% ]& N
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
' S7 n& E- \8 Y+ n) p$ p7 G
; q8 ~9 S9 y* L9 o- f7 W8 P* H/ K -n count Number of echo requests to send.
# l" v$ p r) w. a; }+ e$ K1 ^
* [. e+ p' A+ z9 ~6 ~! q 发送count指定的Echo数据包数。 * N) U/ {/ k1 i8 \0 E
1 w$ T/ D/ |& [, @" ?
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
l/ \- P# b5 n( B9 s " M6 j8 W# _3 Z0 }( b
C:\>ping -n 50 202.103.96.68 ( k' S# D" ]) R5 d0 F2 g+ g8 K
) O* O, M2 o: U7 u) \! w5 F+ d- x
Pinging 202.103.96.68 with 32 bytes of data:
( u: s8 b, j2 C2 B7 g/ [" l , j, [+ X% }3 x1 k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 Q3 d3 u) [- O$ ?5 M+ i 5 r* }$ Q* O7 `. Z' h) P7 z/ y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * h* ?& u) n1 s5 O: _3 P
! R$ D9 |# |: q' q' `, Y1 V1 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! d8 ^* K, M2 L- n& I& ~0 g
! v: X4 R9 J' L- [' |5 U+ g$ t% y0 G Request timed out. Z6 G* J7 p) U( a; M
) V. y) z/ p1 U: ~! [$ X2 T
……………… 9 G% h9 B( ~; f! V2 J' ~2 S3 F
* e9 f- q4 y" T) D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - e2 n' [3 a7 ^- z' O' t2 H
# b( f( Z& f+ b* U% T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- i& v* I- C! a' d9 O; w ' T8 o! u4 b ~) u" T) `7 c
Ping statistics for 202.103.96.68: 6 @% F: d5 `. }! x p
$ w* L O) ^" ]" |: I Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' q: I* b- _, N! N- n; S4 O4 m
( l% a P1 [6 X" i Minimum = 40ms, Maximum = 51ms, Average = 46ms
) f: f+ r0 J$ i" I; L7 f1 C; _. j
& B% J7 W# l- c. n 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ C9 @3 Q& ~' g6 N3 y
* F; U \# h ]3 T -l size Send buffer size.
, s% z6 _6 E7 {. J1 g 0 g8 P# N; P6 ]3 q( T8 K
定义echo数据包大小。 |
|