|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # z! ?7 ]: N) [: z! T* C( _; b
0 N J. |& N: |9 ~8 n p# N 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" x% J9 K8 q1 ?! c* s7 A
. z! n% G$ R- G% ? 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
& ]/ D. O" C3 t' n: K, x & O$ X* q& @5 M4 u# Q+ a8 G' N3 l
Options:
, ^. h0 E1 v! P! d - u. T! V/ V; s$ d
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
8 s9 |. b3 `# h8 U6 w: `( i
. u! Z) q" Y9 p) F- W 不停的ping地方主机,直到你按下Control-C。
% V, l: D- ]; s) [( P; p
6 v. Y) ]3 s# q; M 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) c9 A7 r" U1 u- e% Q* S" v: | + l: O) D: E I- s: ^
-a Resolve addresses to hostnames. ( S* L7 s6 Y1 g1 F8 U. s; k
' c, H5 ^& c% z* p7 S/ B
解析计算机NetBios名。
}" _( p6 i0 g9 e5 g
# ?5 {9 o+ [ ^ e- j5 B 示例:C:\>ping -a 192.168.1.21
5 E% J, s4 u- I+ u. h5 c# }# U. q! t s' P% O8 q5 W
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- W+ H$ ~& i! }& M' E, H3 V
" B) x( Z6 C5 w' P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ Y* v4 q# n; L
) p/ J3 s% T1 n$ \3 g; N) o" T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' U+ O* t6 @( { e4 w( u
' m- W8 A c$ `$ P% l8 | Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) A5 P+ y2 w* u( a. A: z% r7 Z' @* i
, h( [& k1 O6 [5 B! k- r9 ?' R
y5 b& }) U' ^6 v. U u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 J' B9 A' f: `/ V. q9 ?+ a 3 U. D3 J8 A+ v* H/ R& p( a3 Z
Ping statistics for 192.168.1.21:
; B: r- Y4 |! Q# n' O ( R7 e% t) G' c! W3 ?
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , C2 L! v: l& E4 a J' t
" M, o- f2 ?+ S8 `
Minimum = 0ms, Maximum = 0ms, Average = 0ms
" }! x" {0 Q2 G8 @) f# E3 `
4 g; `) ~" U% }7 D4 b& M! ^/ H 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
6 l4 C9 I* _5 f" ^; T2 ?" d
6 I g/ ]/ Y1 a5 o7 b -n count Number of echo requests to send. 5 z( Q" T& @5 w
( j; j, C% C9 G" d& e3 `' k
发送count指定的Echo数据包数。 6 K/ ^4 G d7 ~- s) r& a4 b
( A/ X: y9 f& t* G 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 g# E6 |$ g' k$ ?3 ?' u7 [ ) L' l! T- ~$ W9 [- q: o* c3 f
C:\>ping -n 50 202.103.96.68
4 f& U4 o3 O5 y7 f; J1 o, F% p
: b( m6 G# I( `( P) u3 ]; g Pinging 202.103.96.68 with 32 bytes of data: ! o$ |! Y) i4 z# d. `2 i( q [8 ^% ?
* E1 k6 C( O6 U3 H$ g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' Q: P% ^4 U, ?- e3 E4 ^' a ( l5 W6 w7 f. C% }0 y# _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " s+ y9 [" A& F! U6 T E, H
9 q2 Y& q) O2 ]! Y: K
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ V G/ g0 E# m# E" Y! S4 P1 O4 G6 L
1 K. q! c$ X7 T" ^6 v- c Request timed out.
$ E. r4 J2 P! {5 |+ e5 N: W; h, `
# g! W7 x5 x' O1 v! w$ Z ………………
$ \8 f/ j+ [; V5 d6 n; `: {- J
5 o4 d6 r6 H& \! ^4 B+ H Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 `5 O' m, R" J1 d / K# B! {. W: e6 A4 w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 r, p* v- H- f& D/ o* v
$ U7 D( R5 h0 o4 w0 l Ping statistics for 202.103.96.68:
% H* M d$ o( }5 @" B9 Y; |& V 7 W$ u+ t, G( Y% ^1 U
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' C4 |% m% n" l
5 _0 d* L& |8 j4 f9 B Minimum = 40ms, Maximum = 51ms, Average = 46ms 3 I3 Q7 h8 U, G1 r* b3 b
. R1 o5 S+ @7 R
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; w4 T9 {" Z" M' w _
' `2 {9 ?& ^- l ?. I
-l size Send buffer size. ) x$ A5 e% s; i% j* p
' Y' j, f s* f' q" O/ y
定义echo数据包大小。 |
|