|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 n1 n$ |) g6 C! d3 [3 o* e
. [' c) T; N G6 N. y" V, X+ g1 M) Z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" M- }! j; T( c( w. @& u. n9 X# V ' a: l1 p' N! H7 W9 E9 M9 @& i
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 ( O! }$ d) V8 S# R+ b! U
7 K$ }- h! R7 o: D Options:
5 y4 B5 M ?5 a1 Q' y; l
8 U6 t; ~: j3 A& s$ @ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , T2 n' s9 C4 G" _+ K
5 r0 [* U0 d. Y2 |" p8 a/ n
不停的ping地方主机,直到你按下Control-C。 % C- Q" J( z& w% _' `+ {4 y5 E
% ]6 F0 q) Y+ ?/ T) H
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . ^3 p' m. t% a m
4 E* E2 F4 s* [ -a Resolve addresses to hostnames.
! s- j) H! z$ m- C
. M* g: R$ z! g& L& q 解析计算机NetBios名。 : ] s; n8 C/ W0 C% U
6 m. n& U: h2 _8 x1 o& Z1 j 示例:C:\>ping -a 192.168.1.21 ' z5 B7 [# B: N2 e7 G/ i
- D4 t! A% J; F" v7 P7 n1 w- `
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % h, W; B4 X: Z9 K0 M4 m
. A6 W X! s# A# p; p Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 w) i# f( Z6 C; b
O8 n+ e" V' }; R1 R9 t Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + e( x1 U% G& Z4 g8 }
) W6 ]# g" t( I) A* G) u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 u0 e& k# V! U" M) J& i. x3 d% H
3 b. E) R F9 ?( ?3 D) O; y
! Q% m) Z& O# A3 g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' e. p4 `, U) }* @/ N& o
. u" ]6 A. P) b1 H" ? Ping statistics for 192.168.1.21: + Q5 a3 _ o2 U
. Q A( V, Z2 R! D! S Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: - K6 L3 d% d4 y$ |) ^7 l9 o
3 n- R9 } Z; r& [+ F+ f
Minimum = 0ms, Maximum = 0ms, Average = 0ms
% p( g7 b; ]0 N7 R
4 v1 ]: u* ^# v* S+ L: q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
% H* h9 x) A0 h5 h# x" c$ M' O8 J S , u2 L, f3 [5 O' \" Q
-n count Number of echo requests to send.
2 o2 B% h4 U& E4 I# p7 Q: t* h/ m. X$ ] 2 o: p9 M# A) D/ Y3 _0 s" V
发送count指定的Echo数据包数。 v+ K' B' @4 m$ T; q
7 R- y u: o5 D5 x/ }5 A 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 a) X" R4 C: K: `: A0 y
: t7 o1 a' V% q
C:\>ping -n 50 202.103.96.68 ' A: }1 z2 y3 {$ G8 B( n
Y8 r4 o( I1 O* C9 R: _% z5 L6 F) |& ]* [
Pinging 202.103.96.68 with 32 bytes of data:
w* f4 v0 h7 H7 n x, V& i" o) b3 k, M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 e7 I7 R. s; k% z* y
$ }% @: W& V9 K) s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : o G* H- [& P1 U
* Q% u- s, C) ]) {7 c. ~; k; l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * m; L) P s6 \; G
. q+ K" K+ _* U: L S, q) Y( T# L
Request timed out. ( F5 \' ? c, T+ z8 G
8 t( m. w2 u+ A% I2 J3 L ……………… # ^- N- q+ ^1 w; V" E" v, X0 S
" {. c; [* j0 E' H1 H
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ d7 W' Z" c; o. ?4 n1 f( I$ D; p
5 _. g% r1 ^7 M, ?( ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ ^ r& w% v3 B; `4 L/ x* X % n& {& k* U4 {
Ping statistics for 202.103.96.68: 4 m: u' Q. Q% r2 u! h( `
* f, t e6 M/ m( z4 H2 `9 g Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
& }' E1 i6 s8 H
5 {! q" f# U" {, D& e Minimum = 40ms, Maximum = 51ms, Average = 46ms
' m* K' l P' W. B 0 c$ i6 @2 p0 a5 X9 r/ U9 o
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 $ E5 E8 F( W6 F# j9 u! c
/ j& g4 i" O; ~+ ]4 R
-l size Send buffer size.
7 v0 z) e& j7 N( L9 `% q8 U! d+ S 4 k% M* B! @7 C- l; N
定义echo数据包大小。 |
|