|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
1 O, o# D% G+ {2 a $ {$ a# f/ S7 J) y9 S
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) F; ^. `0 P# D% r$ B% o
) I( O4 y) W$ o+ C 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 4 f: I* ^) f' [' q4 H G+ N3 l
0 E$ M2 } R% i: x8 T. V" R Options: 0 s, m( k) N+ ^; M
& F/ S y! q* B) V7 r -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. : `+ C: v# Q: F' A
5 V2 K2 P+ V7 `$ [9 h" z 不停的ping地方主机,直到你按下Control-C。
3 Q: q1 t/ v* w( o8 h/ ^. {9 U
e1 X; V( e; b9 \: r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
0 E. j! {$ o# u9 m/ t" Z1 F ; F+ f( K( r6 U" c) l. ^
-a Resolve addresses to hostnames.
0 O V) E! N7 X, U" \ ) W% }% n4 s2 ?1 y& g- i1 w6 t
解析计算机NetBios名。
, s" `$ f: g" E1 d3 Q
6 r" W3 `. b5 q 示例:C:\>ping -a 192.168.1.21 % ?- f' J% |) o2 A! f' N7 f
( X. k( e1 F$ d% h4 D" q: p
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; `* e6 ?3 n' {2 S
4 u9 ~+ J9 b+ ~6 K/ Q* q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ W, x) G2 `# Z
2 J, |, ?. H& ~5 i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ N! m+ Q/ E% j; {- C- m! F
$ g1 ~2 t. I$ T4 q0 y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : I) w& H$ d5 ?6 E% K/ B- S
- O7 c# u( n2 n! g
" @! y, N' L/ y1 k; U: q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! b+ p! Y2 a1 W: i0 T
1 K1 x; }2 m' ^
Ping statistics for 192.168.1.21:
3 R, s8 n2 @% O# ^5 ?" c% v
, a% Q- P0 {" ] _6 `; L4 i! k; Z Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
8 C$ `8 R/ m& `! Q3 ^# h. @6 ~
# A0 g5 V: r% b) | Minimum = 0ms, Maximum = 0ms, Average = 0ms ) v8 [2 ~8 n1 h6 U/ J+ \
- J2 J! |% B& s2 \% v. T( O
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ Z8 \2 V1 b/ m1 u
9 c# J, x( W6 L! |4 W -n count Number of echo requests to send.
/ P. A& d3 a% D$ w Z
4 R/ j1 t5 s9 Q" k& m2 o& L, g$ ? 发送count指定的Echo数据包数。
. z7 C6 m Y' A+ j, ~1 W* p
7 ? V% X- D% i9 C* F4 k% g 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; e6 A/ X. F0 y$ e& j
, {6 ` y( @) i6 o- u
C:\>ping -n 50 202.103.96.68 $ q3 ?$ N3 A4 k, S5 O, o- \) b
& }7 P2 |7 Y0 l/ J% a/ {5 J Pinging 202.103.96.68 with 32 bytes of data: : {7 o/ j: b: N* P9 @( w
' B% s* u# W. W0 n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; A3 q. C( i9 @5 M* G
; E' ^% @6 J8 T& H
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . S: B' v8 Q+ @
, j4 O4 J. O6 G: s' N% t, i; K: { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - J; l9 g( O$ u3 s0 X! b
9 C/ R% s' K- R: K P. z: a Request timed out. 9 c5 Z" X* a# e6 R# t
& L+ G7 c4 U& X6 O% C
………………
' o. I i# _; J; N% U6 K: y u. H& w
9 ^: ]' @% P9 ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( X; ^$ u0 _& |( q8 K
. g( S' [$ W" h6 P+ x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; v) \$ Z; _7 F; Y ~2 b# L* J- l
$ I0 G9 O3 w' i' J4 N. @2 E
Ping statistics for 202.103.96.68:
2 ?- t* Y3 Y8 b7 s8 H $ Y2 C( v8 Q% W1 T5 E7 i+ Z7 ^
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
8 d0 I( i6 Y' ^# G
0 R9 j/ x- K% A Minimum = 40ms, Maximum = 51ms, Average = 46ms
% A; v. b5 f1 M* [ - X# q& k+ r8 H. u
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; M7 W! d" Z n
, Y( }& d. d4 g -l size Send buffer size. 8 \( S1 n" j1 J9 _3 u, U' B. d+ e
# D! K: U& k3 g1 A5 w8 s
定义echo数据包大小。 |
|