|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
- Q8 A2 p: M1 y* H+ B' G 6 y! f; |6 S V3 |
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# ~" C* x$ l( ~+ h0 T
$ c7 J" \/ ^3 Q6 b1 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 \" Q- S" g. C
' u' Z2 j- l, ]) o3 j8 E Options: % `3 v2 D. d2 C- C7 D, D, Q
2 P: ]$ b5 v0 o! `- P
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , d" Y8 h9 r( x3 \
: \/ ~! W/ m) T6 N8 M) [) m
不停的ping地方主机,直到你按下Control-C。
2 O7 h4 q' w! D) F' Q
1 a3 e% s. }/ ?' P 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. p. y$ f0 K2 W0 F( f0 c+ x ! h1 C ?. J2 K. g+ n6 `$ l
-a Resolve addresses to hostnames.
) U) J9 \- \- O$ c9 I# P8 s
8 W* E" o$ }# R* R- z @ 解析计算机NetBios名。 8 l ]; Y5 g6 O4 R
8 ?/ D* \, L t h% x
示例:C:\>ping -a 192.168.1.21 # g p4 F( G9 x8 x/ V2 f7 R9 X
& o. z( Q! \8 V& q; ~5 E+ W5 C Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; X/ w8 J9 n% h1 @, ?
9 j1 M* v2 X6 v# j' c! F8 E2 F Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 G' W2 p+ w& R+ A4 p
: Z! {, c8 K% ^# P7 h Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # q6 ^6 f* q2 F; e( e* K$ H
# t) M) ^- M; N2 {4 z1 |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 X. i" N; \/ ?8 M& l3 E" `6 q, _* f8 W% f) \1 m- |, j2 k& Y/ ~
R6 M/ e6 _" V- |0 H% m6 Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 a/ }& s) c: c0 e: D
8 f7 F% r( D: C. @% O Ping statistics for 192.168.1.21:
( g [0 B2 ?9 j) ?- w" c$ a 6 f( h6 s; C) Q: q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
" l f; e! `5 ~
) @7 U/ G3 }7 a7 R# \: ~' Z Minimum = 0ms, Maximum = 0ms, Average = 0ms 2 M) \* I! J \: V
' {+ v) H1 }8 x( R
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 P; D/ ]# @0 y9 x- U * E/ X! Z+ K+ P( Z, o
-n count Number of echo requests to send. $ I; J3 a; P. z: I
5 y1 P2 y! M: f9 F9 M3 P5 J
发送count指定的Echo数据包数。 % i' g; `; F# s: C: L& V8 s; E
8 j3 W& h' p1 o4 R" q" A2 s6 l. ]
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: + {, g7 Q& A/ n' a
1 L+ K" y& A) b) Z
C:\>ping -n 50 202.103.96.68
* x" O' N8 E3 ^ 1 w2 ~4 g: U4 ?
Pinging 202.103.96.68 with 32 bytes of data: * v. @+ F" \" s" ?2 X t {. `
" L' b$ a; m- U7 V/ w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) v2 f5 r a& h & _: t1 J3 d+ u/ j' x0 @* N, t' b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( \; G& }* S; V" R5 n: O9 \
3 j9 H% V: ~- R$ Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 }4 v: W& x' y# y9 T
{% E. m3 Q) {1 B* O Request timed out. . C i" C7 |* K7 e
4 r0 V; p0 @* T7 d( N+ F ………………
$ R* C0 r3 s1 C' ?3 n & l8 O' m: ?. _8 j; ], ~$ g% r$ P) G# u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : s) j* _. O( P, q% b% Q
& W' y k6 R7 x/ \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 ?( V, { |9 t* ]4 e/ X
) F2 C8 A7 K! J0 w0 y0 l
Ping statistics for 202.103.96.68:
% u& P* ^5 ~ W& d8 N0 ~ " u! G4 [- c @. o- e3 D# r5 b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ; T/ \. U& c7 `7 o2 ]
+ C5 z7 m6 T. p0 W2 m/ } Minimum = 40ms, Maximum = 51ms, Average = 46ms
0 I% E& A- d1 h8 M; I 0 Q% t8 R( i0 J3 T/ w) d
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
% e- |# k- ? Y, { 4 C+ D# ]( `0 ?4 Q7 z4 T
-l size Send buffer size.
6 s7 r" C6 T( l7 U " C5 E2 E4 I, b& M) j8 Y. H
定义echo数据包大小。 |
|