|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * e& i, ~" S y" }; W& q8 u
+ c8 u& |; x9 k N; a 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 N) l& N# U0 D2 {9 N8 o- b) g
/ i" w: }0 q$ s$ `! d) _/ B* c
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 : }9 \( F8 R! X0 i$ U
, m6 a6 R, h& t2 ? Options: Z% E( f3 M a: g1 s4 \* f
( S" q" d- _7 ?# V8 h* o -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# L" q0 c) @- Z. M+ {7 ] `, d
$ } U' R+ Q& x2 p2 L+ q 不停的ping地方主机,直到你按下Control-C。
- X) q& t9 m9 T; i# Z
) |+ L3 ^# v: D3 r. Z9 Z# e 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 : {6 M7 z/ p) K" W, \2 z3 {6 J% ?. O5 Q
% Y$ D( a' L5 y8 L -a Resolve addresses to hostnames. 2 x+ b$ E1 J" [
8 d$ W" f6 v# ~/ z$ b9 E9 ^8 M
解析计算机NetBios名。
! L- H6 a& ?7 K
0 N7 _8 V; D6 Q$ g) M: u; _ 示例:C:\>ping -a 192.168.1.21
( e: j/ Q: `0 i0 O1 ~. N& [ ; H! U; h1 {' c' E
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* `0 W3 O1 i9 c$ m 2 h: ^ f' }. U0 Q% y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; `. H& k. M) L9 h ! v' f: q# R' c/ d( L9 S- f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% W! U1 y) Z2 u" K2 t/ X5 L , v e" j" D6 B, g& S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 ?+ {8 y- H& b0 N G ?$ f& m# P3 e+ p6 {
: `2 u* o, |( e. V$ |4 u) l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' u- j3 X" ~, i; f" L% M% I5 f
! ~, \( t* ], P q2 x
Ping statistics for 192.168.1.21: " ]& X. F- F. ~% h: E; c7 P8 \
$ f# K1 @4 q, J1 L m
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
: j6 O3 ~( }0 X1 n4 P
) p; _+ }0 J! x( A Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 t( W7 M3 a2 d* T# h
, }+ A! H& e1 ` 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 c9 \$ Y9 ~. E/ b7 E+ f
/ j9 g, F& ?7 V& Q! ~. s" `" K -n count Number of echo requests to send.
6 ^1 w( S. ? Q. n! I0 X
, g% @" J6 y: G6 N8 f 发送count指定的Echo数据包数。 ( l" Y; A3 t. k) ]) e
' N8 S* N: }/ U. |
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 Q3 j% n& f# [ # }. r' p9 S- h2 |$ U; \
C:\>ping -n 50 202.103.96.68
4 S9 A w, \0 g: w8 Y
5 y1 V( M! l2 o8 i. d Pinging 202.103.96.68 with 32 bytes of data: , [: A7 [( y7 G: m$ u
! t* ?/ n% D5 t O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' V9 X- s; q5 F& U
% Y1 S0 @5 e3 \( d+ O6 Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 R0 l' F; i0 L # d; s9 T8 f, [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 g5 R c* J" C/ ~
' a7 P+ o/ q. L8 h/ n' r
Request timed out. 2 F1 H1 f; n0 j, g" ~
& }& q4 H0 f; T1 ?, L1 u( l% B
………………
9 d$ \& e3 v" M& v9 G: O, G8 e' F/ X
% ~' G% t7 F% @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & V) S. c3 l X5 [1 i
7 p+ C+ i( }: x2 f" A! t& d, [4 R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( k5 O# t: u- K6 D
8 x+ v3 O) T% L1 F, J7 m' W Ping statistics for 202.103.96.68: }# I6 o5 y. ~
- M" C/ s, }- N, W7 W! ~' z2 U Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & t# Y0 a" O/ M$ s3 y
: {9 _5 z/ T4 p( \" d! }
Minimum = 40ms, Maximum = 51ms, Average = 46ms ' q! O- g0 H8 @- {( y6 S
: D8 M; ]; J! r5 e8 i 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 " s, g' v! d% o1 f4 s2 `
; h, [* n9 E2 G i! U" H
-l size Send buffer size. ; v v/ x7 I+ J- P. J: j
! I8 o6 n9 G) {8 c* f9 a
定义echo数据包大小。 |
|