|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 d0 d8 M3 Q( F$ V$ Z
4 q$ J" W6 ~5 w
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 8 w& S& H( j8 ?/ i, t# {
4 d2 W3 y* v5 L& c8 C+ r- I" t+ O3 ` 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 . C" v) @7 m5 N; }* y# h: ?# x
[! |; m4 g+ m7 O& h6 x3 \- A
Options: 2 T9 _( h& p) \ L" c; v c
3 }4 j$ V7 W) b% x -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - u, J: C7 O. \1 |; \
$ ~. L: \: N1 V- U6 }8 ? 不停的ping地方主机,直到你按下Control-C。 $ S: }, D0 I+ X3 ]& i1 x( _: Q. k1 L& S# j
0 h" i* _' O3 i+ H
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 ` E/ S* _" C
h+ [0 ~, U, c3 Y) ` -a Resolve addresses to hostnames.
( _7 r: h/ @' S ! ~: [ ?) ]$ @% T3 i. i
解析计算机NetBios名。
, k6 Z1 s! i3 B7 M 3 A' M1 d: ^1 X. K4 F+ K$ S6 T' `6 k
示例:C:\>ping -a 192.168.1.21
0 f1 r. W1 A+ \ _: N* N3 N) n% ] 4 g0 p% E2 O! e8 i$ @7 \8 y3 I
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: . I/ o! s0 X6 m3 R
4 U- s) Y" s, ? e8 D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% C) M9 v' L0 A( {5 S: {% h% U* d
. z K2 M6 K& }2 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- N/ ]0 v% h" E" x8 Z . U' [' r ~3 E7 L$ ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ k+ j* G/ r2 F8 U& c! C. Y8 n& I; e1 s/ J& E
& ?* c4 l$ |" L/ i5 Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# B# u9 m6 D" G7 N: s$ m* L, j7 {
& C z/ h' e7 g L) Y7 C) v Ping statistics for 192.168.1.21: 6 A* A4 o$ O* C
7 K' J6 @8 l; }7 I, M B$ Y Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
7 f8 ]6 b" [" v1 q5 U4 }' w4 i* i
6 a: o0 t! S( l- C2 L Minimum = 0ms, Maximum = 0ms, Average = 0ms ' l; p0 e7 Q! X! ^
+ l. I$ i+ T0 H% Y: X" K) u3 @0 z
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
9 t' z1 F7 q0 {% G* T ( O! n. m7 S2 c, ^7 E
-n count Number of echo requests to send.
+ U% s# O4 ?2 C5 X% T; X) y
* y% D5 \9 ]3 N- k: X 发送count指定的Echo数据包数。 6 \* s8 H' k. L- B
2 }) ]* |9 {7 J5 Z9 b0 M& l 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: : D) j% q" ]) }5 T9 m
. p. h1 D$ k) f( \0 r1 B
C:\>ping -n 50 202.103.96.68 * B" A* X$ o' o0 l. k2 c* W) m% j
$ [1 V9 W' C: H9 V( _8 {0 a
Pinging 202.103.96.68 with 32 bytes of data: / w9 d$ ] b# |9 ^$ W; o
! t4 T& _& o, _ S1 t+ W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ W5 L U; N/ ^8 ?
. m. s! H) r+ u0 E: D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 v" U' G- r: l6 F3 y! Y4 p
6 ]% @. h3 l5 s2 I, B, a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " t' l+ T% K, X! g
. r2 D# V: W- n' g+ y1 m% q
Request timed out.
1 }: ^3 p2 K5 N+ r R1 o0 k
7 F. W5 M8 u& k, z# Q4 H ………………
) Q$ x8 }! u2 p: u1 n' h
r( M) ?, i* j8 M8 y+ h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* S& t3 i( w$ S) f& u+ U; c ( Y; g" T: q- K: z0 R8 D3 c' z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 z# V$ H; z4 D8 t$ ^- y; }' W
& ], K8 j6 D) V3 Q* F Ping statistics for 202.103.96.68: : F" g% b, ~) ~# l5 p5 S) k
# m' [+ S0 J0 i7 q4 {- K9 @ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : t' N/ i' ^ T, P6 P/ X1 E
" A: _. B- h* B9 I Minimum = 40ms, Maximum = 51ms, Average = 46ms # `/ J& y2 q% s" C* Y
2 n0 u) K4 p3 @5 Y; i+ n
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 {# w, r4 j: A) m, u
4 ~3 h$ b' f, O5 E4 d' g9 |5 J1 ^
-l size Send buffer size. / J6 d5 e) n! V: J
2 F4 C3 F6 x" u: X! {2 P$ c
定义echo数据包大小。 |
|