|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * j( u, c$ i: L
" t6 j, F# P0 b; U y$ l
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * T% Z$ ?: O p, I
! Z. g/ G& |5 z, q 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 + ]- S" T7 L$ l' u# X$ f
, S+ D# w5 I6 y$ Y2 d. ^1 J! ~- F Options:
/ @3 [4 Q% Y/ C* e
1 B( u+ M, i: R$ z' `/ G( Y -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ X \+ v0 B5 l$ j
/ Z$ m3 b! {' ~: j1 u& c 不停的ping地方主机,直到你按下Control-C。 * m9 i5 U/ X1 l0 u. |- E
* r2 R2 j4 o+ {0 X( } 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 1 v, m* C0 {0 L5 ?1 {
1 p4 W2 b+ `: m8 a, |" E* c( @* R+ P -a Resolve addresses to hostnames.
% O' q* o' E/ i- w( n: R& I1 m9 Q9 ` : P; o. f; Z# J. L& H/ M
解析计算机NetBios名。
& y, ^8 ^% ~5 K" [4 n* p3 h9 O4 A5 l8 }& O 0 L# y! P- W/ u2 B
示例:C:\>ping -a 192.168.1.21 / r! s7 _" l2 H/ s
5 O7 \" k) T, `6 Z6 I1 q6 q8 n Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 a; r0 a3 V g3 `6 h; z
/ |# l/ _1 X) ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & c. F, S" @* M$ e1 f. H7 p
2 B% Q' V8 o: R9 K4 ]* B; P0 ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 W- M2 B3 F% v- S; C
* S5 S0 g/ c! D- I( m' t- b( U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 l! Z* U: [: k' y3 P* o
/ C2 d9 Q5 q/ K( w1 }6 q0 N
2 H5 X, k, W+ }" Y/ ^! _
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & J8 V/ ?0 s" l& P4 V% s8 t% G D- `
4 q7 `9 v" c7 z; e( w. G, O
Ping statistics for 192.168.1.21: D7 p7 K) u" O5 x% Q" |
& Q# Z: W) n9 u; C1 @: k% w Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
4 F! a; ~& [8 P) z - B9 r% B+ X! J& q+ X! x
Minimum = 0ms, Maximum = 0ms, Average = 0ms 2 f9 g3 d: K9 M% T1 G3 P
, t, x( Q7 f4 P) Y" H8 y. u 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: M, _* b! y! ?3 K2 d 1 }; |1 l( p( `5 K% U
-n count Number of echo requests to send. : z# l @- S: _# a
. ]( E; w0 h3 d: z: ?
发送count指定的Echo数据包数。 2 H4 U) ?6 d$ ^ k
) T+ [7 W# v) P 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 H7 y# J+ f! p. f( Z
4 S* O' ]4 e6 z0 o6 D- c
C:\>ping -n 50 202.103.96.68
1 _' ?+ g( K, b% Y. m
, T! g: Y( u" `/ g7 J5 ] Pinging 202.103.96.68 with 32 bytes of data: ! d! ]- ]+ y- f# x* a1 O
9 L4 G$ V, j7 Y% [" g! }( n, F( \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 C- e4 F9 R+ V8 a" @4 D5 K/ v + ?7 h( v+ \9 V2 c( M5 G
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# r# f% k$ h) A9 D7 u) u' ?4 f2 @ w |8 N0 r/ Y: q) ~, R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * Q# x* c/ Y" |' s8 n7 ~: c5 Y; B
% C' x( O1 }( ]$ V
Request timed out. " f6 Q! Z! ?9 A/ ~' ^& L
# J& A2 a' m9 {. i+ O
………………
( ^5 J: P- ?% \( s* y+ S + _0 g D% i7 X' O8 z; G, Y$ _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 J0 O. n2 M; w" q
* o+ H' p+ A. T; o5 R' v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, W" e4 h0 M4 C) H' k8 |5 Q: h: F
4 F$ W9 |* d7 n T% p5 y+ V% k6 ?9 l Ping statistics for 202.103.96.68: ! k6 Z* n \+ @
6 M% u& M7 H' M7 C8 e2 H9 [: z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 5 M: _1 x+ z9 _/ C# z5 q6 p. ?
0 |7 [5 f o w0 W+ D7 e4 P+ o% x0 Z4 _ Minimum = 40ms, Maximum = 51ms, Average = 46ms
$ N5 d# B( Z/ ?0 c8 h8 ?! R' A
I( q% d, r% Z6 k. P# W6 ] 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
5 c9 D, \. P( y4 ~/ n2 \; w; g S5 ~
- a" o, { a* c -l size Send buffer size.
# E" i- d; @: _4 D# i# M$ X
+ V! q. N0 S' X' ?6 j 定义echo数据包大小。 |
|