|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
& M) Z+ C0 d* |, f
, s; v) B' F" Y+ S' O# o* H4 x- w 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # i. i( x& i% G3 Q& d) S( ?' k
N" A( D; N9 G: Z* L' 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 # ^1 }) `" t" x9 O9 A( g' G/ E/ L2 H
4 Y: A5 n' V6 V4 f! h/ E& ?8 k
Options:
+ l2 ^1 s w9 Z. {/ o1 h
j h9 y! I8 N, o& O0 s1 Q -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 9 n! u+ u0 n6 U1 T; B" G7 T* K9 e
5 P! B& Y. z" p
不停的ping地方主机,直到你按下Control-C。
( P+ m, ]7 q! D1 ?. P
7 q. `- z; G U5 a$ W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 / D6 ?4 L* _. k/ x: |( B
2 R- J* ~ ]$ T- w; _9 K. i' t# R -a Resolve addresses to hostnames. 9 \' Z# }* f& u# j# M( m4 Q! Q# t
$ D" B9 `7 f, q# i) h8 ^
解析计算机NetBios名。
7 H. h) C/ T" ?& {+ \/ J1 `: k
9 i7 P; r1 {3 y; N- Z! a% e 示例:C:\>ping -a 192.168.1.21 2 t6 M* Q, X! M' B3 h2 u
1 W/ s p0 M( _+ V* \2 ^) ?7 C, y Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 F" Z- y+ G. I" |! l
& {% d+ M1 ^& N8 W3 E Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* ]% v' N( m, z' S
& z/ q) b# F% \# i3 R% n( H* Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 B( b/ z% y- L; w1 X6 \
/ R3 @ I3 v" i4 Y0 Y6 S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 i) h( P/ f- o, b1 W# B" `& w
0 a7 \1 F- f5 w! ^* x) L
$ ]4 U2 X D6 d6 @) W0 r' N$ J2 y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
x0 f* |- M3 s1 V % `% j% L9 T) s, v9 L2 L
Ping statistics for 192.168.1.21:
4 v9 U9 ^* h- g( H" ?! N( i7 \! C0 | , w) X; @/ M8 X! `0 I
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
) g' M8 J- [: A: k0 c& C
& V; e% C: `5 v! \ I Minimum = 0ms, Maximum = 0ms, Average = 0ms
' n$ j+ \% j- T, s " \, i! ~* [* S
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 {& o+ Q' a/ O7 P: G. s# w
0 s8 Q4 E. c2 I$ K
-n count Number of echo requests to send. - H- D2 s% }/ F# \, S
) T& w* m( P$ c5 K( U+ b2 z6 S
发送count指定的Echo数据包数。
. `( y& y& E' u/ }8 x' t8 y* Z
4 |8 i- \6 w7 U+ K# I, W 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
. V+ ^/ T) G& b' h1 k " Y) b3 H: W6 a8 `+ N: V4 H4 n3 h I
C:\>ping -n 50 202.103.96.68
2 s* T4 d9 r( e* K- `% j* W
- O) X$ J3 K5 S& G# {; n, l Pinging 202.103.96.68 with 32 bytes of data:
) d8 ^7 C% f- W: B# b2 G+ ] K! m+ k a
, C) o' ]7 z+ e Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. j" N1 Y7 M+ n4 Q+ q& x; W; n4 f 9 ^" L/ u' T0 f0 [2 s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' O# \4 @5 }0 f( w* [8 ^
) t( `! G- X/ K" F- P" L& C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 k# Z9 ]+ c S 7 H0 n* P3 E4 B; ~4 p
Request timed out.
6 k. m. B* Y1 o# j7 c' X
- p. q. k6 ^3 [! P( ?+ t; B4 T$ ^ ………………
; w8 W& g9 C& p1 L5 x
5 C5 V! {+ M/ Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 u. t+ d( p" X8 |# D" j# K ; C# i# g+ o2 @$ U$ S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( \% b& s5 v# c9 d: W
6 F# I( U% e9 i. Q0 N! I Ping statistics for 202.103.96.68: / t# r: |) }) W
1 u0 L, f8 N0 b9 ~ p2 w+ | Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
# H% W) U2 _; N' i 1 a2 O2 D+ l4 y
Minimum = 40ms, Maximum = 51ms, Average = 46ms
( d! o! a7 d- l* ]- I2 o& x ; V) n* ]* n9 B8 J$ W) x
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 @9 e, H* N* ]/ N" c: ~1 E3 K. H
2 w5 V/ w* C2 z0 a1 L5 m -l size Send buffer size. % l- T" {8 h. o: {
( k& v/ m# ?* |$ B# G 定义echo数据包大小。 |
|