|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
& ~3 {4 v5 c( o0 k0 Y" g; c1 h+ P ' V4 u- D7 s* ~6 V9 G# Q- `
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
t0 o& x4 o+ G* H# M s0 a5 y) {4 k7 X4 A
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 , D( t' l& G+ z8 r# B( F
% g3 t& }' F) I% _0 y/ t3 E
Options:
) C& y7 ?" u# z4 I" n( g ; O& l1 E; E# Q4 x( f( l6 I
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# a: v( c$ b0 M0 B* @; J0 J 3 _+ r% G3 @4 [6 Z& Y& e7 c3 X9 Y
不停的ping地方主机,直到你按下Control-C。
+ n3 ]- r3 g9 G; s( o% P/ r2 @; B& F
& `+ k1 {! L& a0 p! e# L5 V/ r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 % w* C& L) ]% X
1 P) {5 Y+ R% P0 l
-a Resolve addresses to hostnames. 7 u4 S+ _4 ~/ h. ~
1 R+ @" f( C& k( p5 } 解析计算机NetBios名。 ) u% i& I" v( M6 e8 ^% ?9 r8 N* c
4 x% _2 y% w+ k# Y, m5 A 示例:C:\>ping -a 192.168.1.21 2 X6 d& x" o6 p% V9 G5 Q( B- ^4 c8 P
) k+ \- P3 N; U$ |
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
) o. ]% O( w: q" L+ G- n $ d. Y! P' O% |% b( P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' i5 y8 z/ j. K- H- v ' f- M* L9 m+ p# v& Y% g
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + X4 T& w, Y# \" N4 Q Y5 T
& V, ~, l' B# b8 q0 F. W0 T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) D: P! n5 b( w
o% Z2 T$ U4 d; m3 |' x/ ]
3 w' V, G& l Y7 `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; L3 G0 Z5 Y& z) J; |
, G$ F# u4 }) {% ~0 S$ P/ H
Ping statistics for 192.168.1.21:
! |% l4 f- S4 ]$ e. y1 P2 r. Q: y9 h
3 Z. ]6 X }+ `* {! q# _1 P% U Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# n; J1 |2 z {; V ( G2 B5 U, b$ }% | f2 _
Minimum = 0ms, Maximum = 0ms, Average = 0ms + {8 X& C) \! P8 n1 P8 e
% Y$ V+ H8 T" b5 K 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 4 @& Z# |% U9 u* K# n
* J* [/ K+ V6 D& }4 V7 l- \# q -n count Number of echo requests to send. - p4 x; O5 p* ], \1 M$ W; P
8 v) l( j. l/ v6 k$ H1 m5 l$ ]- Q
发送count指定的Echo数据包数。
3 ]& K z) ? `1 J - ~8 L6 L- f% u& W9 l; P
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' \" p8 {- ^4 v, b. p
# P- u5 q& N3 Y' E. I* a
C:\>ping -n 50 202.103.96.68 ; T8 N I% k8 N" g: Y! K+ B6 V
7 D: h6 r% G5 q7 r6 o; } Pinging 202.103.96.68 with 32 bytes of data: % B O/ o2 }) }$ k; l' R
5 G3 z! o2 q2 v% Z* I+ m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 f5 J- y t& h8 q% x4 Z8 ^
9 H3 E6 n$ L) d( L: L; x6 O0 K
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ~' ~0 \6 [) I" [. j$ l: t
6 ?2 A7 k/ f4 D6 c) Q6 G; A6 d5 n
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 y; J4 K! I8 H1 g0 j: @1 w
4 K: M, l( O' f% Q# d6 _8 E
Request timed out.
/ ^- T/ m/ L6 l- l6 a ! i/ Q/ j- P% e: u$ V& T. j2 W
………………
) H5 _) ~3 p/ t- v! n) B( l ' a. c: Q- g& d8 g6 L* i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* Z& O7 l2 B* @
+ j \) H3 u5 O* Z4 e5 y8 m4 p( g& L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! ^% w3 u6 A3 s) p
3 N* d' h2 d. w Ping statistics for 202.103.96.68:
! X, |# |) l* r$ J% u/ L S6 ^ 2 `! a4 u4 e( {
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. O* h: [9 y; ]; A5 H; g8 x3 I& _
" I1 G1 t- M4 B, Y) Y: ] Minimum = 40ms, Maximum = 51ms, Average = 46ms 0 p5 |+ q, z0 v
9 R+ O" t+ e$ H2 { 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 % k3 j: \8 S; e6 W' y
5 ]* M" n! S X5 y* t
-l size Send buffer size. 5 u$ T. N0 T9 K/ U. M. Q
$ y5 O) n7 [" {$ q+ |/ B: @6 ^
定义echo数据包大小。 |
|