|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 N! p7 l3 @9 n/ h7 R
* l% t. d# ?$ O7 l' B7 d7 e
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 G9 Z- M% T3 J: X& ~" E/ S# ] ?
7 V% _+ I U: w7 e+ W
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
$ d2 v& G, b& i& S% I5 R " h( y$ x) p+ X) Q
Options: 3 a/ U4 T! U- r8 b
& h( Y7 X; R# l1 k& D1 c3 ^. N- `6 @
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. " |0 ]" \' e& z0 ]9 M+ t! p
" W4 T; e' Z7 |( {/ J$ ~% H
不停的ping地方主机,直到你按下Control-C。 6 J/ @5 G, t+ o
5 e9 \' ?5 q4 r: _7 n% ? k$ T 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
O3 n! e. d( c( N& x 6 S w' k0 L/ \& O# ]& M
-a Resolve addresses to hostnames. ! @3 g" v+ k* q6 v
3 a# T- t& l0 [$ x) L2 H; r3 v
解析计算机NetBios名。 ! } H$ v/ b1 ?* o V
: J$ A( M" B7 O9 a, L9 v3 e$ @, f
示例:C:\>ping -a 192.168.1.21
9 ^4 N; u6 m. s& Y/ C- Y
4 E+ e t$ [9 g& M& ^ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- u) d9 e+ d( c! R/ {. m , w i* L! y- h/ A3 D U: ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 k" t) K: h* G/ @4 j6 i* y- L
- h M5 D7 k& d, y; g; C, Z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ T- q2 I0 I; ^0 U7 ^ ' x9 }8 P$ t% O1 v+ _
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 h( U8 A. `$ ^! a9 }
: h0 A: j# ?# B ' [$ ~3 e8 q9 Z( K! G$ c2 x8 v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ z3 b, X9 ? X
, P3 q0 U' `) W. \$ q- H Ping statistics for 192.168.1.21:
+ F# j# h4 Z: ]
. ]7 X+ `" v/ t7 ^ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
$ L2 _3 c! N T0 I! |6 F0 U4 D
0 f+ L$ j4 s" V; M4 B* ^9 K0 \3 k+ l# d Minimum = 0ms, Maximum = 0ms, Average = 0ms
7 j$ \2 {9 `9 J7 s
+ ^! Q" \. X* |, c, O2 t 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
. K' _0 d5 v" ]/ ~7 t
% w4 |# F* }+ Q7 K -n count Number of echo requests to send. " u/ w. @" N& {% K7 q' i
4 x; ], b/ s, C8 z1 X+ a 发送count指定的Echo数据包数。 ; D0 O. c. `! z* a4 R, \
7 x. c% K2 d# M7 @2 M4 c! _: `+ @+ Z 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
5 \7 C0 {/ @1 z4 r9 G
# c; i8 g% [) } C:\>ping -n 50 202.103.96.68
6 n$ a( @1 D; [8 t
8 ]- |, h4 f- t1 K% i4 Z Pinging 202.103.96.68 with 32 bytes of data: ) j2 d7 \- k. ]" ~, {1 q
' O0 s; o/ l; a5 E! J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ y7 J9 }) l* i5 y 6 b6 Y- p; D# W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ I- f0 n% s) d# `" S/ n0 `
0 j) r# U. i5 C/ q9 J- { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- A3 J! B' q8 u; b/ k ( z7 H- B) w/ f* j5 D- W
Request timed out. 2 j, }8 {3 [( P3 M$ O0 m
4 i F, `2 t% c5 L& I7 m: R
………………
+ B. | i+ I1 j3 `4 q1 i8 m; X
" A: u% l3 H. L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 U# H N9 s3 ?! H- `: [ 4 q B; _& t' g6 \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 |, R7 z& t: q+ o
# q) o# B9 M# B) P6 k4 a
Ping statistics for 202.103.96.68: w o) m* u5 C7 D) F& w! G& T
4 F, @0 l! Y. n
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & u. L# w3 O" c; m( y
0 _4 G- E3 I7 Y+ @% W
Minimum = 40ms, Maximum = 51ms, Average = 46ms ! [8 i( ] ^% r$ m% L1 a5 Y
, o0 J. U/ B, P% e! I! v
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 g* R+ h# e! K; ]/ x5 L- A; N
9 _/ I4 @& Z6 Q; }" { -l size Send buffer size. 0 x1 e# J" a+ O+ L
# _3 Z3 a' y0 S2 |! c2 J. e8 Z3 L 定义echo数据包大小。 |
|