|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 b& R6 R6 g1 i* X7 I5 r1 M . r+ X: S/ d2 b& X! D& R) v
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 C8 q2 |0 h& E% d4 m( |# M( G
8 v% l3 j8 a, i; z. p# [ 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
' B( k* o, j5 R3 V, W' t
8 I& w' h; f5 A+ e3 P Options:
/ S+ F5 Z3 L- s$ T& ?
& \! F) ^* { c6 u0 T/ r, a9 V -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 a5 X% f* p8 m9 K4 k
$ G, T9 P0 ~5 s: }( k6 Y2 s 不停的ping地方主机,直到你按下Control-C。 : i) N. R* n8 Y' j/ q8 L
: N+ U9 Y. _: c, X8 ? 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 4 O6 q3 f+ [3 U* v( X7 @. g
" B, K3 ~$ W/ ? -a Resolve addresses to hostnames.
# K6 I' u3 o1 O5 g; |. p: x ' L6 A' K7 F; C# P1 q; h6 T% {# A
解析计算机NetBios名。 . S& O& h* q" E
5 i- F" x1 f9 J# x5 c
示例:C:\>ping -a 192.168.1.21 , {0 c1 `* g0 F# Y& B
# f G) Z8 {4 F5 W- V- W% n
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
7 ~9 @$ o c7 F2 \; p 5 A4 q$ Z1 d: V# e* y" j: M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 w, l6 P6 |! f8 H9 h1 ` 9 x, G* F0 h! E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( d& T) W( ]0 H. M
) m5 g. B- D, _ N B. b* U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 C- X6 C! d5 e% P
0 g! b K% B0 b& s; B& w
; d6 v5 ` v; E+ j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 u/ P) x' x+ Z) R: E
4 P6 Y$ g# y4 F# ~& g3 O Ping statistics for 192.168.1.21: 9 `& Z2 h, U" m3 y, k
. ?+ t2 Y& w6 {$ f! j, X! L Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, }, m6 v) P7 t, N/ w: z% J
: q! h5 `: N( K, i7 n; F Minimum = 0ms, Maximum = 0ms, Average = 0ms ' A: n' Z, N U% N* V
" q: d0 `2 ~* ~6 T2 W
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * @- F: F$ ?4 j/ Q! P. [
4 d2 y" f, U5 L9 I6 L' {1 | -n count Number of echo requests to send.
, y6 g6 j6 t3 M% i9 I @5 T
H$ \- |+ P/ ]+ o1 p 发送count指定的Echo数据包数。 p8 n. W2 t& e/ e
8 b. d* Q$ F4 Q
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - J$ Q6 b% }/ u+ ]7 j3 s
- P$ k$ _( e. I) z' ^ C:\>ping -n 50 202.103.96.68 - @5 g: E* r6 d+ W
$ S+ C u$ A5 r5 q. [# l* U) ` Pinging 202.103.96.68 with 32 bytes of data:
, E& T g4 M% Z ]- U9 O9 b
( h8 @6 t' k2 ?8 G/ Y- w R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; o" D! F0 h7 J' u L6 t
& Y- X; ~- q. w! B$ D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! D: k; K1 g% e( V2 h1 |8 {
/ b* m7 d% K+ n1 F# H i2 i# J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 H$ [3 R" C7 g3 u& e9 z$ L% F " M+ @" H2 ~' f0 H0 \7 h3 G1 _# w
Request timed out. + k( g; g1 T: w2 j1 E+ v
7 l/ m9 Y2 b1 q3 e) s+ K
……………… . r' G; o5 ?- z, X% T. ~0 V
, G" V: p3 R' v$ f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' a. Z- [5 E. u. X0 ?
6 Y# J" ~+ G7 p* M- l- u' X2 F Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% h- ^/ H# w( q6 J6 i4 z + E' m3 i0 s) ~6 X% A/ g+ h
Ping statistics for 202.103.96.68:
6 q Z/ j+ @' v6 `+ y1 I
, n3 P- N" j, ~. G! c" ^ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" K7 d' q1 r. H( A4 T6 }3 h # C8 u! {2 S r# K
Minimum = 40ms, Maximum = 51ms, Average = 46ms 4 C L1 a7 q* o( l) @3 K
3 Q$ ]% r9 ~3 @# B+ R3 K
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 Q' h) w* ]' c! ~) U ' O8 l" X' T8 ?+ d. b: ^7 q
-l size Send buffer size. 2 L: ^' ?. F- R3 b/ ]
S# s# A% Z6 @# r+ L( w 定义echo数据包大小。 |
|