|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 % A2 r9 N. F m$ J% q* i( Y
4 a* I1 I, ^! x 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
3 V2 W; C6 D+ k9 ]! ]
" A! k3 k! a- @# X- V' I 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* W1 b" q! \7 `
a, H5 O2 U! k( |: G4 N5 {% X Options: - V1 W) ^9 U1 S2 i2 D7 v; \, ~
% u: @' R8 x- [- \2 o) K -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , ]! u* K4 s$ r6 w5 x
' T$ ~" e, R) a/ r
不停的ping地方主机,直到你按下Control-C。
9 L/ ?& x* _% \9 [( R( b0 ^
" t4 D- a5 Y9 e! R 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 3 _* Y: \& y" R2 ~: k1 p
- [' q3 j, P: R& {3 c* U% { -a Resolve addresses to hostnames. # l8 h; t" ]9 C' U z
4 m5 Q. t: M- d! i0 V2 Q 解析计算机NetBios名。 ) Y; g- `) y4 Z: [! ?+ P% R
1 h J Y% t8 w) E, X& @
示例:C:\>ping -a 192.168.1.21
% t) a. p1 e3 U" Q. @ g6 I2 O 7 b2 d2 Q) ?+ o* z' E+ e0 a
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- ]5 f! `) m% w : c- q# U( ?' e/ _
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; c; ~: N/ L: {
% s$ V$ M. E& |' d: l Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" B5 n% C6 q* S4 ~7 q, p; j ( I' g3 a) V. G* N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; X2 w z+ @6 c+ s/ E6 B5 c; Q% M3 o/ q |# U) C) k8 v; j
! N* I, @& p" o; n- F
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 G9 T8 P7 h+ C3 z. Z& A
9 B0 c; @3 p4 ]; W
Ping statistics for 192.168.1.21:
6 A+ A3 y4 r2 y+ v7 W# T
3 J# B" k/ ~! o& i Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 9 }6 B- {$ H6 s& r3 v
' M- I3 C9 Z" y0 B" U9 P Minimum = 0ms, Maximum = 0ms, Average = 0ms & |4 a! b+ b. N7 Z! S$ F
$ o0 |; b7 g: |& b/ E0 N1 [% \) w" D 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 w# w3 M# |# c4 o
; x7 y( ]( ~% q" a: d0 P% A% M" C -n count Number of echo requests to send.
v* x2 W3 O0 R
7 f0 n- ^- t; E* C- c' Q* a: \ 发送count指定的Echo数据包数。
' L7 _' B* r9 r e* n! h. A Z
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 F+ a' c: n( ]# Q
9 r- q* l+ F5 S2 c$ y5 I3 A C:\>ping -n 50 202.103.96.68
, C0 a# O* @% `, ^" l 0 `5 C r C4 G+ }8 b8 _+ @
Pinging 202.103.96.68 with 32 bytes of data:
X7 I9 a# t# v0 ?* b8 `
' y, Z* l4 k" e" n$ Q A$ ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 [, V2 \7 O7 L/ a+ S1 F% J$ V
5 |% g6 m4 r; f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 O$ U9 T, A" l
( f, z' V' [6 ^, p6 h6 | ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; w% T+ U8 B" A3 {; e; E! |2 {* C8 N
?; X: f6 d, v. f4 n, B
Request timed out.
. C. K* P4 S0 w ) r4 j& B$ l( Q' `8 V1 L
………………
7 \; {3 ?+ Z5 p! j0 P ( y: X+ k" ^" O' i0 |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , S1 q1 w/ n2 E8 }: v s7 [ v
5 P. d0 X, T; t0 h- R2 g+ U Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! l( ]: y/ m2 k. n( \
}0 v! u: M0 I Ping statistics for 202.103.96.68: % s& U) M8 h) k1 p; h
6 B$ F1 @0 g( `" V5 h; J Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 9 |: S: U- W! x2 E8 c
6 ~8 f- p# l M Minimum = 40ms, Maximum = 51ms, Average = 46ms
- r; C' Q: D$ `: J " z3 f# e) s$ f- [7 n
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
- W7 y% K. T# F4 i5 [2 F 9 A A/ |, ?: \3 B& n
-l size Send buffer size. 6 e+ }1 L2 p4 k! u6 H% I
x+ j9 c9 h; {3 w9 o
定义echo数据包大小。 |
|