|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # c) V; f: g* j- f1 E9 R/ v2 b8 ~8 q2 y
3 @2 d8 x5 I, m% B6 [
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: " ~" f6 z, ^' K+ o: v6 @; e
, U( A$ Y. g1 ]) |& Z2 k 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
F2 \* b- E1 J# _+ A ) T5 a3 j! S8 A% a2 J* \
Options: 6 y% ~8 w5 a( ^1 o% A+ X
; z M( z! }2 m& E: N6 F$ S -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ! i2 q$ z; F: W
$ H9 H/ s3 G4 F4 p 不停的ping地方主机,直到你按下Control-C。
# G* E* y0 l5 l, E1 H % u0 S1 n" W& }, \2 d
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 \) Z7 `" f, c- e) {7 ` 7 \2 w; v- y. t1 x; J
-a Resolve addresses to hostnames.
5 I7 v" V- L6 w% i1 r: ? * d( C4 A1 J0 j$ ~/ w c
解析计算机NetBios名。 - ~! V6 m# y8 V y( R2 S
8 |4 ]& G! Z' e, B 示例:C:\>ping -a 192.168.1.21 % r1 W, k4 _- V; k E
a& }; f% [8 u* v1 r
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
2 l0 j' C, T9 ^ & ] W8 D' |( u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! c( C& R: A1 [, U, ^+ p, A V
8 k% e- o8 X8 n# X, m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : H: b J) K5 `& f
) x" n, h' y: p3 H# K$ `& U" k Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 |5 N4 J% a# G* f
& W9 e* }4 C) T/ N- d3 o2 v
9 d I5 d* M. R+ J: \' F8 d5 |; j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * W- k& i! K# B" H8 }3 H; n+ V0 }
: B4 z. }4 r$ w% _$ k6 d
Ping statistics for 192.168.1.21:
% G9 F8 Z+ g( @) ]' i; e' Q
7 o# j/ w* h) F% Z& j+ t% J; M Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : g- h0 j1 J" d5 }) A- w z7 [
7 W6 S/ R/ D# r, L
Minimum = 0ms, Maximum = 0ms, Average = 0ms : y8 X& x" w8 w4 V0 n* G, |5 m# R' E
|9 o: D8 g( z: r! P 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ g5 i' {! S7 _1 \, h
4 p) g( l8 `' o% {3 M* ~
-n count Number of echo requests to send.
' `4 y& z' [: P5 }9 N . N w: i3 u# I, s, a! `* y
发送count指定的Echo数据包数。
0 Q1 ^( [2 I. n2 B: A
+ B A2 B8 V5 h 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; G" j' I9 L+ A4 C- e; I- E3 h
0 E" U2 r+ |) [+ P3 Y! l$ M C:\>ping -n 50 202.103.96.68
" c& i# ~5 T6 N6 _ p4 n! y8 e
( @+ Q, F5 w, o& `& ?2 N( S Pinging 202.103.96.68 with 32 bytes of data: / t7 ^) w5 F! `* b' m J1 t7 Z
) V, ]( n# d& V; u5 s3 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) d. z" o; L0 B+ g+ D; X) k k % d# T$ r! e5 U. W2 |1 [( S8 ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& y3 `& U6 h/ w' \$ q
& a& u8 _7 b& T" ~' n) Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
U' e8 E) {& T& ~& ]! T4 J
% j7 e3 W" `: i# ? Request timed out. % E( C( q! ^ K
$ [; ~, p- u, M0 b) r& u8 J
………………
" @; Y0 n, c, P. s! }4 _ 7 q( m- z2 ]" b! @5 q, y% \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 Q* u6 x% S0 `+ v9 L q
! {+ y s8 D( x( A6 a* x1 M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* g9 i8 U r3 G# V# }' s# f
9 _, I. A% ^# u. N1 M+ T2 g Ping statistics for 202.103.96.68:
+ t+ `. v4 m0 g- O2 u8 |
9 Q% T9 K$ p% i# g% ] Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( p6 L) u* z. L3 q) D2 l4 p
; q# D+ F/ l; m Minimum = 40ms, Maximum = 51ms, Average = 46ms 6 o+ z0 K, E1 P' V$ n) E
3 B9 B* N6 J$ S4 g% V1 Y3 Q9 O
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
( `$ l/ A) E. p% C 3 s7 L- ]! Z( |9 o6 h0 N0 m
-l size Send buffer size.
; R: ~. \0 Y6 i
* n4 @+ D( ~9 _: i" c 定义echo数据包大小。 |
|