|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * P! R! `! H( \0 O- i; D0 |+ c
! Y- G) M) |6 [" q6 v 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: : l/ M3 p% H3 k) U+ O) m& ~% _) i% V$ T
! O3 m, W" i) l& k: w4 O 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
2 M5 x( W6 `5 T) O - t% q" a$ o! N: S- |
Options: : @+ i' W- t7 h% _: P7 H
2 M# c, r8 `! d0 C( ?- l
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # i- n9 ?$ `7 O1 P0 A
5 K) x" {& }2 w( I( \: j0 t B
不停的ping地方主机,直到你按下Control-C。 , U+ L& w# U0 Z) A% P
+ g1 U, V/ p8 \1 X& o: _7 o
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
P: w7 K6 p- d# O+ y% N, b1 I+ v* g
( e; F& q( k& b- x$ K# a: r -a Resolve addresses to hostnames. 6 M5 x: V/ X/ L2 o
" G2 e4 N4 z6 g. Q 解析计算机NetBios名。 9 {0 j, ~4 q7 x$ s
; ?* P5 A* f3 I. u8 f
示例:C:\>ping -a 192.168.1.21
; G' E& z6 C7 O
, G# v8 @) x# f P; Q Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 7 i% b7 g8 o, i' Q0 }# q
0 b& W& Q9 S, v) ~% ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 z" t) L8 y* I3 d. \, B7 m * c$ l% r# ]! u# |0 S2 c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 W, j( ^; |- k g: o
, G3 E; Z. N( q: U6 k5 {8 C Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 }3 T/ h) X1 S: ?, g$ ]7 N4 P! f" x" h
. J% N; m# g+ C& M# ^4 {1 q" H Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. N+ N) H# d b9 c5 k% [, F3 I % @/ W& Q8 j/ i9 h! X
Ping statistics for 192.168.1.21: * N1 F/ h7 s6 Y4 i4 M* b2 w
% o1 e7 X. s# ~" f: l, a) r+ O( t/ C _
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % j4 O( b& L+ b& P/ I4 A
) S' o1 M' q# i' H4 v4 [! ~& M5 V Minimum = 0ms, Maximum = 0ms, Average = 0ms
: a& J2 \& W! Y* L! }" V
% k* f h* ~, W+ U8 } 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 4 T |9 q0 O0 e& K4 D
9 s8 K5 x% Y7 F, [* e5 K/ T* h+ M -n count Number of echo requests to send.
. | E. ^& u" Q6 S
6 h$ {+ Y! ^, Y+ N1 E! Y8 c) W. }, W 发送count指定的Echo数据包数。
5 a7 O. r/ j* T5 z+ _8 f
# ~4 V4 f6 t4 E' C# ~: j 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* B c$ i% }9 B C
7 A% T4 H4 h% j, K% I# }7 A C:\>ping -n 50 202.103.96.68 1 A! Y @# D; f& I z
3 n& X/ _* d; R) W& W% o
Pinging 202.103.96.68 with 32 bytes of data: ; Z$ {8 D) m- T8 H2 V
p0 q# J! ]$ S8 B# Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & k$ z2 H8 y4 V% K
b) T: L. \! M! E9 d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 v" `- K# [, \$ l5 C0 C
/ }1 g: m2 `* _1 d: S0 X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - k1 X* p3 i0 [2 |6 R9 d
7 @' m3 \3 a1 s9 R$ q3 q( `
Request timed out.
! D' ?. D0 Z: |7 ^/ { 5 d5 ~ Q1 N7 v) f: M7 o1 r4 c
………………
% f* k! X+ {6 Q; Z* i$ f , G% l" X7 s) b- _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- \8 N. j# I& S& h) w, w 9 K! f2 e9 R I/ p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
~% S/ V$ s+ j; o% o1 i4 P: F- ?! k ( w9 u1 `5 y* M8 q$ E2 R0 O
Ping statistics for 202.103.96.68: 7 z, a; V6 l O x& Z4 b, O5 e7 A
) d* e0 L8 A) t& Y8 B Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
/ [5 B3 V0 ~1 T% V9 u) v 9 g- [, u7 ~$ R1 Z
Minimum = 40ms, Maximum = 51ms, Average = 46ms : e* @, G& N# J) Y3 X+ {) J7 u
/ j. j$ Q7 O$ O, W; J
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 a E& Q6 Z$ q0 R9 @/ b1 U `! F5 R+ X) |+ n- ?4 M
-l size Send buffer size. , O/ J% n7 L- O
' A, M- C9 @" V3 @
定义echo数据包大小。 |
|