|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
( Q" O3 W- j7 b/ w; q
( F5 t4 N8 v' o" }) R 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
0 r* ^, ~, N/ d# C0 l , ^! N, f/ w4 I+ u8 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 , A- D6 ^3 \; {/ s/ B: Q" k
* d3 p- |6 b4 u9 B/ X, b; I Options: $ S; ~8 ~0 N8 z4 g: D4 ]
* r% Y; W! d: @8 Y -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
8 z5 I! W0 N/ e. S9 D; B1 k+ l
; J l4 R7 w7 w/ s 不停的ping地方主机,直到你按下Control-C。
: ^' `0 j- Z8 T+ M4 v9 S5 S : i& Y" k9 W& s* W- |" R. q
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 L/ f l# P7 a f; ]
: X4 R) ~ a' f$ c -a Resolve addresses to hostnames.
: r1 }3 w& _. Z f6 z - V. m7 s0 i5 t5 b' P& ~
解析计算机NetBios名。
& U- c6 M3 p* \. \) G
% f- k0 O% [6 i W 示例:C:\>ping -a 192.168.1.21
* q S( A+ p( l5 P) x& I7 P5 s, ^
5 `) H0 }1 I7 t3 X( R3 n8 N. f& j Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
; U6 O5 s9 K8 I
& ~7 g" G# e" ]+ F. O- M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. C2 C, h6 u- U; D3 J& l" P) o # q; u& @7 V3 x5 F2 W+ T- ~0 \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % m8 b8 w, x0 T- l- q4 ?
- C8 o, Y5 T' u" }2 `0 O I/ ?" } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 r; q, v1 _$ n) g, ]2 [; A( t) f. v$ b& R6 g2 ^: T) g
2 v5 D R: o, x- t8 R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; p+ r5 M4 p, b& |. l: {. |4 L2 T
) Q2 m* f% J; W: _2 r: L: @/ l/ m Ping statistics for 192.168.1.21: 4 c2 [$ Q( X7 t/ u5 e5 c3 |& \
# c: |* c2 S: \$ W* f7 ^ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
% s& Q& w" w z# H8 c3 a & [. W: q+ Y7 K9 P I% J
Minimum = 0ms, Maximum = 0ms, Average = 0ms & [/ u6 K& e8 S3 ?
, |( @4 u% F* f$ }; q( P
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: t1 a2 w4 S* s& G2 c: h) y- z / C2 s- c( s# g# O5 T; u$ D4 P
-n count Number of echo requests to send.
+ o& p k: Q. Z/ X _8 ~6 F ( i5 l, @4 H, s- P1 K
发送count指定的Echo数据包数。
/ k: V" ?2 p. H) ?, h6 o& B% Q
R; d ^# g6 @ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( g/ x( ~5 B3 r/ ?2 w( S' Q 8 t5 y7 o% S7 G; `1 N* Y S' y
C:\>ping -n 50 202.103.96.68
7 W1 T% ^7 A$ i
4 Q$ r: {6 Q5 S3 Q3 o Pinging 202.103.96.68 with 32 bytes of data:
* i+ {+ D6 V y2 g& G " l) l l1 Y8 X6 S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - X. k! S! Z/ I7 k1 q) ]2 u2 \) v- d+ _
/ X5 D% O% Y1 H$ q4 {8 }% _0 {! @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 ~' E- p' T+ ^
o( z( k0 D; S4 E8 D. }1 E. R5 x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % h! g. i6 S) g& U8 i
3 y' a9 A& h* V: m6 O$ [. [& R
Request timed out. , h# x5 m5 L: |+ b
" _7 a! D, J- J$ Y2 C
………………
3 D2 l& P6 m/ A2 D a2 r8 Y. C
5 R# c* O& f/ j7 k0 H/ N# r, d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! y) m( z. D8 R0 X$ v
' j, C7 R5 n, X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 V, I& B9 }% N! ^
J4 G- E2 ?. V" c, C Ping statistics for 202.103.96.68:
5 G# M2 n% g# X 9 p. I# Y& X/ G6 W6 {
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 B# C' V- _( |
9 s4 M* D/ ]# w
Minimum = 40ms, Maximum = 51ms, Average = 46ms % ^$ s9 F, q% z/ y
- ~7 Y- m Y" C7 ?+ o 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + |9 M+ U- w3 I
% ^1 y' d5 J; H8 G+ T
-l size Send buffer size.
5 V) `: G! |4 o/ A4 G0 [ # K3 Z x0 R- P3 {1 g6 M
定义echo数据包大小。 |
|