  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
2 z% ^9 Q8 {, m6 n, y - Y# d% ~$ s% Z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
4 C$ G9 n- F8 T* }
/ H- @% j/ v3 O D3 @+ Q# 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
4 t) m( @$ t$ D6 j # A* P8 L' k( | c# m( I
Options:
- S, h' [, V# B$ e$ ^# m& U1 z) n 4 a" q% S7 Z" Z' h
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
& a% R; V6 s4 V6 E" {# g8 x( E
$ O2 Q X* z0 L; Z8 B 不停的ping地方主机,直到你按下Control-C。
) }7 a, m/ `( K2 ^7 o / Q, i- V' m9 O
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) L @) V% z) j/ y! ], m+ m 8 y) p4 V: ~ ^( k |
-a Resolve addresses to hostnames.
# F4 K% z: b2 |1 `' _, v
, D) e" c% s. L9 K' O8 u 解析计算机NetBios名。 4 @+ V$ N" g: h3 w) B
' h7 q8 i" N: I) _! t: \ 示例:C:\>ping -a 192.168.1.21 ' K! g7 D) F- t" j6 T: |$ _
, Y3 W, B( a- q- L" i3 m* d
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
& b, X6 W' W. n7 W1 v0 K $ P; Q- m/ n d/ Y# {" _
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 R) u% x" ]5 A5 v8 {
' U6 N+ {+ l. D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & ~/ P' b/ o B9 s* J, G
8 Y- A3 i1 O' m$ [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # k& p5 J# l! R- H7 S; R( A
7 l& S8 K9 { l. B. x2 m
# Z5 J2 B+ \# u! P; j7 V7 g c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 S+ I2 M0 p, I; p# Z
- h7 o! K: J9 j7 t+ V$ \8 c1 q Ping statistics for 192.168.1.21: # m( d2 d7 u1 P8 \, Z8 f% h
( X0 T$ u* O2 S* v% V! j. F
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ; a' S/ @2 f: G2 m# R! N
; v2 N! C- M/ L; |' o0 b$ s k% \
Minimum = 0ms, Maximum = 0ms, Average = 0ms ( A! q2 n) A+ _# s
/ S( p# y3 y% E# H: T& t! j5 C 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
2 }* [: m" V/ W9 n6 X |; } / ^2 F/ ~7 Y1 O( z5 a
-n count Number of echo requests to send. 1 X) t6 E+ }$ l( U/ s. J
) t+ Q+ {1 _7 n 发送count指定的Echo数据包数。
" X% ]/ ~' Z* }5 M
& z' Y/ M! ^: N- p2 S" F1 U 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% {0 I: t1 }5 w2 |; m( P 3 k! u n/ G4 N
C:\>ping -n 50 202.103.96.68 + @: ~. N8 Y# A D
' U8 p0 K: ^% ?/ }* }3 @
Pinging 202.103.96.68 with 32 bytes of data: % K$ Y4 b! j, y4 y: Y8 o2 p0 @
" J- x; |6 t4 E, y5 B
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: ]. Q7 p4 w, L1 h6 M6 N
, d( ?6 r/ f5 }3 P% ?8 A8 z2 x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" W' v1 c ?+ ^' f. P* D * u5 ?5 b" V" }: `4 I& z1 p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - b2 O2 s; g8 q! W0 _
& w4 `6 v+ ~, A- w8 S9 h8 L
Request timed out. y4 ?8 A# \7 k( _4 {4 r
9 {4 w- w, R4 y* l3 v- e" t" [ ……………… $ B3 }( \ `, k! V
p1 b: a3 _8 m. g+ ~; E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 c7 G f% g% x4 T& U
$ k4 |3 e- S: m! v) `6 C6 u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' y5 A8 k5 |0 b0 J; E0 I: o8 v$ D0 L
3 ~; u& _& {* N1 E. K- B Ping statistics for 202.103.96.68:
D" u. B( A0 K: S. A4 [2 s+ Y 6 ^' K0 ^9 G8 V" s$ z, a
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 ]7 N5 d! x! k5 i- D% [6 C
# w$ ]* P6 A' t7 l/ ^* X8 C9 P# M
Minimum = 40ms, Maximum = 51ms, Average = 46ms
. ~* G; y0 I' X; A . k1 g0 u% q8 V7 P( m" V F
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 X4 ?, @# c: r ! c- O0 h# m, Z3 y( o8 }
-l size Send buffer size.
7 |% M6 k0 O k/ Q$ j % H& j4 h( m! W5 w
定义echo数据包大小。 |
|