|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ ^$ @8 q6 [$ F5 G
9 x" i2 |9 [- ?/ G& R6 U7 | V& N 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ) d1 q0 |/ |7 @9 g
' u- Y3 q+ Q: v: V. ~( `
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
+ Z2 \2 K6 i0 e6 _ y0 V6 I 0 N% }! Z2 V' o
Options:
% a/ K6 r9 [& v% J9 f e& M 1 I/ h" i" U# N1 i+ U, j3 E( Y
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 h. l a* }% Q9 x/ z J) P
' Y0 U0 M* Z$ O }- w
不停的ping地方主机,直到你按下Control-C。 8 I6 k2 m, k* `& w$ K0 J
2 t8 b0 J& k, K, S7 S 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . m' `( T" c3 W' }( h0 N2 T' ]# Z
P1 Q1 c% `( C
-a Resolve addresses to hostnames.
: I. W) ]8 [$ ]/ E# [0 K- L 5 `* o! V: A! ~/ A1 S8 r; k1 e
解析计算机NetBios名。 \! l+ R2 T+ v: [, e0 Q. s
k, E, F7 s/ [7 y" `3 ` Y 示例:C:\>ping -a 192.168.1.21 + f: P, A) u9 V0 _2 d& w
5 A$ O* d, ]! T* D. W3 l6 L
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
/ A' ?5 r0 o/ K O
% o3 u* C1 k! Y. v+ l( s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 b& U/ _- q/ \ I# p7 T
% ], b3 }, B' l. B* _ b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 N0 C8 B- m1 M
, V v% i; g) `# l; l/ b4 s4 @ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 E+ b% c9 L+ `7 V9 Y. f5 S
$ S9 T2 ~' Y+ \3 `
+ A! u( q. P8 ]6 B$ u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 ]$ k: d) T; ]7 \' }8 l9 B
% P/ r7 Z6 S$ B0 j6 q1 @8 n* x/ I
Ping statistics for 192.168.1.21: ) _% Q% h" g2 B: Q4 \6 k2 O
- X4 G$ S- O! ]$ q* j$ ]2 s( A i
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: * y: E. E% Z! T
) n. K7 x* G* S1 O Minimum = 0ms, Maximum = 0ms, Average = 0ms % F0 D" X/ C9 E: I6 J
7 H2 C9 Y5 P* B3 p; M/ e ]! U: ^1 s$ s+ v g 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 / y4 j0 V& i; C" e' D: P
' O7 x9 I" i7 d3 U' k
-n count Number of echo requests to send. - R$ n; f+ h% C1 @2 O6 j
9 z+ s4 j& W% f9 P
发送count指定的Echo数据包数。 , Z& a* z8 R7 g, K7 }6 F
g7 G/ U4 C5 y* L: K. c/ K 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! A( a5 [, W5 I: U' i# C2 J, k 9 K# o8 E }( U; F7 v
C:\>ping -n 50 202.103.96.68 ' C+ H' D- e0 z
- ]& H! U9 u i* {+ w0 m- e Pinging 202.103.96.68 with 32 bytes of data:
3 B* i: ^, G4 Y & ?5 I& j9 F5 B" W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) I+ m! A6 [ o: L, b % K# s& X- [, x+ G9 U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : @- i) E) H0 K# F( a, N, b5 z
! p! ^' G9 ?' L t5 S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 s8 |: v7 B% z . D: }3 b) N! @( e- I. C
Request timed out.
: N2 f% Y8 {1 v# w1 b! i- L7 D 4 Y6 F2 \; w7 z) I, u
………………
# _3 W2 i; n- a; m) ] J# O' k
' g+ c, q2 r% A5 s# t; M" I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 R; I& f, V! D5 v/ r+ }: S
) d# \8 F7 p4 D U* F2 A8 M* ^$ D$ M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 }. j& |% i3 s
0 W% l6 A2 Y1 W S' m& b( a% R' d Ping statistics for 202.103.96.68:
$ n5 T: a7 m3 v. F' B5 i+ o8 e1 p 0 s" M9 I+ A' o: N5 u6 `
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' V$ r7 g0 {; I, W" H- @! T
5 n$ G3 }4 Z: l! ^. u* ^4 U2 }
Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 j3 o$ i' Q. Q W% |
% I6 Z/ `7 a4 R/ F3 u! I- i4 H 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& L& d: h& ? I0 k9 H) I4 Q ) G* C, s' R2 Q: n
-l size Send buffer size.
% \' j$ D( E {' \$ E r9 _, a
l: q" x/ {9 R0 e 定义echo数据包大小。 |
|