|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
5 ^; L# L+ v6 \- _; y) E ' H" c9 a1 t5 c4 b: ?
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * a! k' M' j+ x7 d
8 f, h* H1 B5 n* J% n
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
( M* ]4 W2 E4 z& j' @2 j
. d, K. p2 b/ r% M9 e8 o Options: + u9 P; [( F. M. Z% U% `7 R9 J [3 ^
& J! {7 u; ^0 @0 e5 j7 p) |9 v( c -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ; ~3 t8 x a0 c3 T( @7 S
. {: }8 h( L. k' M6 O# O2 V
不停的ping地方主机,直到你按下Control-C。
# W# d0 ]* M& r! a8 m 9 \+ c, z* `8 H5 N
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : l( ?$ P( S: L0 _9 [9 ~
& H! p5 a( M' l8 x b -a Resolve addresses to hostnames. ' O/ x' t" \: Q
! G! i$ z) x* J# n0 j* W# C 解析计算机NetBios名。 2 |) [* g# ~9 @+ U+ b7 \& e/ \8 K: H
5 q$ y8 v4 w, ~0 a% U
示例:C:\>ping -a 192.168.1.21
, z3 J6 G t3 \0 ?9 O9 w: [ 2 \& y5 v0 n9 B0 s; Q
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
6 p+ W% o, O3 s$ v$ |- u: s4 x0 C9 E
; Z- s2 F3 E8 C6 d2 C Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ O' d' A9 P" B- _' J
) F4 Q5 R+ H" k) @- t/ E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & b3 a* M& y5 P! n/ ?
: X# p! q; \. `( }' y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% I) S" T! y4 Z1 D1 b
# \* U! W0 G$ j( Q0 _) G' t
8 }4 d, T% H, d' b3 g; B! o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; m- K. k# ~* R
& b* B0 _4 E. Y- X) L# g. e$ S
Ping statistics for 192.168.1.21: $ ]: E; w, c$ G7 ~% i7 G3 K+ ~
* R3 x/ w9 C ]9 t
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ; f- v+ V- ~7 w' \: N9 S: ~ K4 l. \
/ j5 a# o: j% y% l( Q4 `: ^+ s Minimum = 0ms, Maximum = 0ms, Average = 0ms ) k3 Y2 K8 C. D
8 T' J% ?/ U( h5 r, _7 Z/ `1 v
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ' x& B. K' t6 D( ~8 N" W' R* C
' j) S9 u3 ?+ j
-n count Number of echo requests to send.
7 K( {) E; {+ L {6 w; d# K
' [9 r9 D7 n* [# A; i3 P 发送count指定的Echo数据包数。
% o6 f |3 g7 ^, {: m ; G6 c0 Z6 y- g- b4 Z0 ^
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
4 e* |- [; |! B$ d$ z1 G 9 {( r$ k$ P- \3 W
C:\>ping -n 50 202.103.96.68 - R9 S0 {6 g, Z7 F2 B, _. n5 o
* D7 y w5 u) R" J% q) l2 n
Pinging 202.103.96.68 with 32 bytes of data: 2 ^3 @9 G1 M( Y0 w) x. @6 j
0 z9 \: N4 @) {6 c9 U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - E" u& |1 E( C0 @ a
* w# q7 m1 I0 `0 V9 H. x8 u! I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: V! w& e. f7 Y5 \
4 o( p- @$ V/ c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 \/ Q% s3 L" J3 h- m " {* k: d2 _- T8 Z- C+ l
Request timed out.
* T0 P/ {! u7 H- r
, n6 F! v+ z2 I) r: f8 K" U ……………… 9 d: P# z8 m0 m" X' z1 }
9 E4 T! f- V& i9 i l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 d) M; f4 e4 d3 P
. m; L/ ?) o, Q4 A/ Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 n8 y3 \, {) i6 H. Z$ V7 I
0 v; a ], v+ |0 o) y Ping statistics for 202.103.96.68:
k4 U$ t7 r1 {. W+ G% n
; s$ f4 O- d, ?$ d f Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
) _. C+ z3 Y5 N6 F
4 y1 u3 J; q+ j* B, v7 e( r Minimum = 40ms, Maximum = 51ms, Average = 46ms
9 V) x! [1 |* ~2 ^5 Q# K: `. L2 u. s
) d; _- M% d% _/ n 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; s1 r% X2 m. D" H
. @+ j4 v! a7 v+ p0 `
-l size Send buffer size. ! M9 U4 ] \6 o1 E& Q( u; h
9 i; n# w9 D( w" E, X 定义echo数据包大小。 |
|