|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
5 H, n, B9 P: i# D3 _* y+ R& z
1 Q3 }- \3 K7 r! R" l% X 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: : V- y0 Y- J4 ?, z
2 H3 j% F* l" O( X8 x( n
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
3 n! W9 d2 Y& _8 @1 w; A) @* @ 2 y8 p$ P3 `- G
Options:
3 l# U0 J0 r5 b/ ]9 i # B$ m+ O5 z" F2 o: l! V
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. I; s5 h, H) I. ~
" j5 G$ ~1 ]+ I& h7 y5 l5 Y( p1 \ 不停的ping地方主机,直到你按下Control-C。 + c- d/ Q' E: _8 l& Y. v
; r3 G4 y2 J" n. z! s J% Y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
$ A+ O3 a) s- G( `+ } s* B ( D5 ?8 X! b! O5 R, \' I9 C: h
-a Resolve addresses to hostnames.
" h% F5 K5 F# B( ~' V& r
- P7 \! g' b1 Z0 f2 o 解析计算机NetBios名。 ( p* _, Z8 S- N- X1 u
1 N+ Q+ Y/ M+ O1 k3 d5 c- c 示例:C:\>ping -a 192.168.1.21
% x4 R* ~) C! T! o
6 R- b0 O2 n6 M- d$ X Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 4 n; `$ @' n) {% k. ?& }
& y* Q# {# K7 d. e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 G) V6 B# y L) J6 P( T9 V% }6 l
/ r- h% S% a$ h! s% u: u% ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 q3 h6 |1 y5 r
/ s# Q5 `" Q" l# X" `0 g Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 Z" I6 A- \' f
$ @8 u) Z9 I9 U! ]9 f: z) I
2 B z* @% l5 V) @2 B; W" Z0 s2 ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 {% Z. A4 w2 T, [$ Y" `& B+ H
; @* m p& v$ p& @- y7 O6 k+ S# |1 } Ping statistics for 192.168.1.21:
5 R- H! R' V/ M / `) z# ?; b8 `+ N+ P
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + D6 V! D3 |! n* S. g: Z
- | J4 u& }2 U* J0 Z3 c$ d Minimum = 0ms, Maximum = 0ms, Average = 0ms
( _+ ~4 E+ R, Q! M3 F
# ~; b: d/ a5 }! z9 m, D2 E& V 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 V) i# M% y8 A% @# q4 \6 I9 W
% W5 V3 C" J! [) k1 J6 P -n count Number of echo requests to send.
4 W0 Z8 I9 Z0 E) S. L6 a- k& m0 l0 I # p0 D# l4 _( T5 @7 F
发送count指定的Echo数据包数。
9 t* E: C: m! k6 c" E4 {$ k2 y4 v
% a' W7 y; r, H, s5 w0 } 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 S4 E9 m* r# R! w4 f1 K) i; a
! J+ G6 G/ L8 x8 T1 U C:\>ping -n 50 202.103.96.68
) @- Z2 t. B/ d0 j& [ 8 P, b r* a* |9 U/ N
Pinging 202.103.96.68 with 32 bytes of data:
# X0 }$ Q% U m/ ~) p
" `7 d( `' g/ G- y% X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + k: ?; M4 v D
: W* [! W9 z$ ` W' X0 M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 _$ n7 w( e4 z* X; b. J- _# n 3 T2 d3 m( G. R+ B4 I% @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( j% X' @' e' u/ [! T. W! | / v3 @& a9 t) }. J- E6 D9 X' x4 F
Request timed out. 9 ~+ V0 ]5 G& D+ i" l3 s
& f9 c$ a4 M/ ?9 [ ………………
: Y6 O" g% \# O& q% D, a
; H3 }7 O% w( t/ l# n) Z# i0 i9 j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 J" k+ ?0 h3 u7 [2 g, F. S6 H% \8 R . T% e6 O. L4 d' G* }% O7 C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : l$ { h( P2 l" u" ?$ s
% r/ ^ u0 c# W, e8 ~ Ping statistics for 202.103.96.68: * k9 i" _1 m* E6 R3 I f- ~
/ S: H; j& `) n* R
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: # R; X5 M1 Q# S" |) o
0 `7 l+ B4 P h) w8 ?0 [
Minimum = 40ms, Maximum = 51ms, Average = 46ms
$ _, T: i- k3 S9 f# W& ^+ Q6 W5 X3 G
1 P: Q. S7 c* s) [- o& ? 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ) a+ T5 a* Q: h1 w/ G, T8 b
# ?1 w+ F- K: ]
-l size Send buffer size. ! U7 F# B9 |3 x7 E3 n# |
/ j; j' o; h6 C' | 定义echo数据包大小。 |
|