|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 & P" t, y H) t: v. T
( Z4 [8 p( A6 V% o 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: + E# V4 x0 S9 ^, I8 w8 ~& E( _& k
3 f( T9 i& K% [9 H) y, A
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
! h7 A. m& Q F- H+ k 4 H. C+ H+ P V( ^
Options:
. k$ D3 J' Q; e. q" t. E3 P
1 [- k, E/ x0 f6 h -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
8 j! P2 o! P7 b) y' y- V2 `6 x# W
" E4 J$ e- h: b! q 不停的ping地方主机,直到你按下Control-C。 _9 h3 L1 ~) |5 b r$ v% u
- s. m0 S# k7 @( h( Y- c 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 6 I7 C3 [- k f& r8 i9 W
( ?9 x* j+ ^- M" a- V+ @ -a Resolve addresses to hostnames. 4 W( [& Q* X8 l& F; l
- l1 D$ N; ?; }7 _2 m 解析计算机NetBios名。
& g/ a2 N2 Z m6 p
, [2 d. C4 m& t" p" M6 T- M7 w 示例:C:\>ping -a 192.168.1.21 , E' |+ `6 y) h7 l8 s
- ?4 w, N; c6 H% H" m Y, H
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( @2 O* T) B2 m) k5 Q; r
) U5 E) _& c1 A% ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! A$ s2 `+ ?( J! }! y
0 p$ O/ D! Q* E& @9 o( `7 i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) x; s* q3 Q8 R6 x& ]
, U3 B1 L' s2 L' r, t+ ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, r6 F" |3 l1 j1 x& @; x I4 ~: `5 S7 G, s: [5 G
0 k9 h8 Y8 X9 r1 l9 B, G5 {. U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 I3 a0 L" [1 n* a+ Q: z; f* h
, y- U$ O' ^7 e7 f$ b
Ping statistics for 192.168.1.21: 5 g1 q, i9 H2 }4 }: Z' r j: q
; l. }$ O F( g( S5 V2 h& X) V2 r
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: * V/ j( ?* M* f6 N5 P+ Z
7 V4 Z+ Y1 F' a9 Z) x& B: w Minimum = 0ms, Maximum = 0ms, Average = 0ms
5 D6 g; x& q8 q: ^3 [" ~# i
; n% [6 d2 q/ V 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
; Y1 [% p# M( q: \7 j9 h& t & t, S* w3 r$ L2 I% A5 R/ ?
-n count Number of echo requests to send. ' R* ^5 |+ U9 \* r0 b1 m
9 n* [# v7 {7 A8 N* Z, N 发送count指定的Echo数据包数。
& p T! m4 R( T) Y. P/ }& M
- j9 M# d7 o7 [+ _# w. w) m2 | 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 1 [$ f) N7 n5 e- i \$ Z4 T
" b V) k, m; r- n$ [7 m$ t8 V* o C:\>ping -n 50 202.103.96.68 6 x8 F8 ^+ T' j" {' P
R6 C: `* X3 G" O; ]" S/ K
Pinging 202.103.96.68 with 32 bytes of data: 2 {2 `% `) U! m7 I
2 t& I; Q7 [) F& f# j' b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) S0 ~& v% D6 @" y B
! I& u4 v$ }9 W! R. {" B: o) U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# ]% S0 r" m5 ?3 z* w% Z
) p3 y$ _: B' ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , f! @1 v$ Y4 A- n8 F6 n2 n
7 _4 e4 @+ v. U* \- n8 d7 C
Request timed out.
3 z; k8 h* n" ?' t4 m! ?& c
% r$ y9 g+ j4 p ……………… & ]* m, U. P8 u! T7 T1 S6 V0 k
4 V) @5 N, M$ r: E7 C9 C# m" Y2 U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . p; ~4 O3 b \$ L( s. k
& k! a+ f& b9 |$ v/ ~7 N$ } Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 p5 {0 v& N& W9 l
: w4 y# [. q: v Ping statistics for 202.103.96.68:
Q* N, T8 U/ ]: G
" L3 p8 b1 l4 f Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: + E4 G5 D" R3 E8 g3 d0 L& _/ ~2 Y, F
5 h; P2 c2 n& @ o- ?/ }* w Minimum = 40ms, Maximum = 51ms, Average = 46ms
1 [7 M% Q3 @ q- i* Q3 ?' M
: h D% V0 ~/ ]3 y7 o7 Y 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
+ r8 {2 ]& F' A7 y2 c+ A, K 0 p, ]; T8 e# Q& l( Q: Z/ l" G
-l size Send buffer size. ' k t d" v" u8 b6 P
4 w8 W% X$ O5 w# x
定义echo数据包大小。 |
|