  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
! _+ i' B7 G1 F, C1 F P+ V
: c$ i* v" O* p+ O* y6 f 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
{0 g" r/ v+ k . K* V0 K) `, X1 ^; z
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/ O7 {- M0 e6 m: P8 @$ I
7 ~% d& `3 O% l9 S) b6 r- _ Options: & r) h% ^5 f Z; x
( H+ d2 @) \) H, c# ^
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 3 `% P: b( Z: i2 |) ~0 f
: p; \, H+ x2 V3 D( [3 Y
不停的ping地方主机,直到你按下Control-C。 8 W5 g) M6 V: h9 H7 f. Z; J: _
8 q6 f" P, I' ?) b; K4 g1 e: _$ M
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
$ M9 X. A5 W }0 H6 ~
% b6 P8 y6 q" p6 Y" s# U -a Resolve addresses to hostnames.
" ?! G0 _* v& A/ T' d7 @( a 5 f$ r) o* e ?, S6 T) G
解析计算机NetBios名。
+ h2 U! u( ]% _0 {5 o4 @ , q8 o8 |, s b7 A. w0 x0 C. S
示例:C:\>ping -a 192.168.1.21 . ]! t; Y4 y) n# P' q
( Q! t1 K6 O0 c Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: a5 @4 t4 P5 { h3 P8 P' y
3 i$ p0 V7 K3 l+ E# X Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( u6 _9 W9 X: \9 k
9 ^7 g) m2 s; g( q) ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* U1 {7 s- Y. U- F4 Q2 \ ; B. c! c8 _0 \+ v: G# i! q# p' K
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 E- V6 i: F( A* J, h
8 O1 {1 v+ C& s/ }+ f& W, V0 M' s+ d
7 n( {* }! H% q* C' a- | Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ X" o7 Y" G& k- o2 k8 u1 d 4 s% m# I7 B* n
Ping statistics for 192.168.1.21:
( w: t% ~$ _' s+ l( M5 _* p 6 N$ A4 C" l# s$ j1 Y
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
$ w. c3 M0 I' w+ f! C1 A% C
) w8 L9 \3 V6 S. W7 l Minimum = 0ms, Maximum = 0ms, Average = 0ms
0 }" k4 n8 N' y ' u6 V- x- I% X; `" i+ \ k
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! y D) B5 T J' l9 q) I 5 n: G2 ~% G; v$ f% c9 q& D4 l
-n count Number of echo requests to send.
$ s$ o2 |6 O6 t) K8 j$ k
- k: A6 A2 t, H# @1 n 发送count指定的Echo数据包数。 5 y; n/ R' V5 z/ j
- P0 F, U r C' ]- r
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: # p- N" o/ x5 i
. q* i' J, g3 [ R6 T' W; n C:\>ping -n 50 202.103.96.68
! P+ m) _, Q2 A, G( O) A
5 N* i# |/ v2 U! ~3 V8 k5 ` Pinging 202.103.96.68 with 32 bytes of data:
9 S& A# q4 T" T, ~
5 X1 }; q+ l& E; A# e y+ I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " ?* u0 b' v: s5 T' t
( N( }2 M6 ]! N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / B$ ^, |% c" N
v. X/ W- U; o: \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : ^. Z2 V0 q, `8 h8 F% q% N
, I& { W( C8 C; Z, O# E+ K: z Request timed out. $ N* j- I, v. I
5 Y& r' F7 }& t, z6 Z r ……………… . Q( M) g+ J. m- G
: d; K' `2 I; D0 t, V& x" ?! {
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; ?; s8 K$ l) s' Z' I3 K9 s 2 k. B' Y- C' v5 V7 n- h# h; P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ f% J. w/ v5 a5 W: [) G: H
* n; E& H& H. L3 o: a9 @ Ping statistics for 202.103.96.68:
# _4 L5 C0 d2 v2 h8 V/ p + ^) X% o. y' F$ @ h% p/ m
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 6 k$ ^5 }+ m2 Q. C
+ W2 e# M( d8 v- o; }3 K- O Minimum = 40ms, Maximum = 51ms, Average = 46ms - b7 y: A% q* R! R. M) N' a) R1 A/ r
4 `) z9 S$ e+ o* x7 c4 [ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 / V. t7 F: s2 F/ @' X" b
% \; ]: a( L- [7 r7 J8 p
-l size Send buffer size. , ^+ B2 T: D9 U! {- i2 s
4 e5 Q8 C0 r8 P7 ?& _8 ? 定义echo数据包大小。 |
|