  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 Q) }$ j4 r3 o) n7 G
, p; h: |$ Q0 D* j 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) a- l+ e7 S) x( Y 4 Q) D! ]! f* j( K1 s7 M( g
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 7 {+ H6 O; I1 t0 ]8 z
' T# Z9 J7 U I
Options: 3 t1 \7 I0 @) D- E- W6 N
3 V' f8 ?0 a% g# C -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
' L) }; z. T1 `$ X1 O * [5 J( w( t7 H% W& R# u
不停的ping地方主机,直到你按下Control-C。 , c. s+ n+ q) j0 L( I4 [+ y! Q7 U
4 t2 B) q I- ^+ K( Y' G, H1 ]# K 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
; F+ j% c; `; L2 [ . T. ` x2 k6 q j
-a Resolve addresses to hostnames. - F( ?% h0 u4 ]( t9 q$ @( k6 ]$ s n
3 K( P, H; w0 E* K; r: X, _# K 解析计算机NetBios名。 0 S: w: a% S( Z6 c/ }: X
8 Q/ r7 E1 _& } 示例:C:\>ping -a 192.168.1.21 ) X: t8 Y1 p: S* F) P
) Q7 I" X, I/ w& E6 ?7 f* Q
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- z0 i7 }5 t# d8 K: E6 [ . H" F8 r/ X) S; O) S5 p: F
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 c7 g0 u6 G* E% q* H( J3 y; a/ L
* G; [5 `8 `- f7 d8 L+ z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, T$ ~; u& R" W8 x1 ~4 w + q7 b! j0 |7 a+ A7 J9 y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ X( ]0 a* ?5 ]- G/ [8 O/ \: j& T! H* d" Y6 u3 A5 v' B) {# c
]& b0 X' t3 ?; V& }- h9 Q4 |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 C& K9 p! O* R. z+ K
% p3 f* U1 j x7 Y9 P: w$ @, ^ Ping statistics for 192.168.1.21: 4 W1 n* S. R0 F: q3 s E, u" x5 B
% F' z/ J8 U' ]9 |4 X4 U9 S9 k6 S Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : X6 e. C. X: u* v/ O. L4 L
4 y, m( k7 D e' o& _0 q, @ Minimum = 0ms, Maximum = 0ms, Average = 0ms
' C. p: a$ S; F& z3 H" p & s. s- K; X6 o' C* A B+ Q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: g" U" P4 K9 p6 b' ~# u9 H S
3 u" W3 x6 {6 o1 ^7 @( |6 j) {( [ -n count Number of echo requests to send. / `: q, I" L0 H9 x( E
! V* V' v( ~1 p( A5 d 发送count指定的Echo数据包数。 ! U' d; {6 t0 i$ V
- T0 Z3 P, A+ E: |: A 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
/ D5 M5 d3 D. S: j: s m
1 A( {" j# g d+ j8 P. w C:\>ping -n 50 202.103.96.68 ) P6 v, B- z8 g2 V( O4 s
- h. X1 j: F7 { Pinging 202.103.96.68 with 32 bytes of data: : L$ u$ r% v, F* V0 |/ F
% i+ H& h* a6 u, V9 }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; L, _9 X1 c5 K8 e* R& a c, L" G2 U
1 M) D5 o0 n8 @' {# x8 n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. g" B' V# |% H8 m $ {9 ?" [! Q8 R$ i# U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " |- D9 s1 p3 z
# C' ?6 {0 j) c p6 O* |& m; J Request timed out. - e7 w3 r$ X$ ^. y! |
* c* q Z3 @1 W+ b+ q; I
………………
4 @- K4 T; B t$ j& h " Q! R" `5 O# U1 W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
@9 Q% M0 O! v L0 W 9 D; I0 P! w8 C" B
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % f6 a. ]8 U7 W4 h
3 `5 L# A- Q2 j Ping statistics for 202.103.96.68: 9 ]2 ^: Q G8 q9 H; ?' O, q2 ~+ p
7 ~5 k6 f3 p' ?6 v1 g& z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 1 n2 n8 h9 r( w3 n0 A
~' d7 Y8 [* r" j: d$ f2 z; S, j2 q Minimum = 40ms, Maximum = 51ms, Average = 46ms / F3 M' Q& ]! v- p1 L2 `
) R3 p6 k+ ]& c+ E 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 " ^2 f# P- Z6 S) x, o) Q
* q" i4 L# I1 b# ?0 N% | -l size Send buffer size. 2 V3 L. |5 c1 }% w7 Z; i
- M2 D, s# m7 H8 [$ g 定义echo数据包大小。 |
|