|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 2 O; z/ a* v! r
9 c5 U2 R4 B+ q$ B& m* f0 X
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 [' P& M- z! a9 Z" l' z" T* n
% N9 v0 [7 o1 G1 q& t% K: S 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 " E! E9 ^3 G6 I5 c8 x7 E
' o/ U/ }+ q: I
Options: , U6 [- l/ r3 O/ u8 L
- l3 l1 s7 I+ H% e; G# y1 u7 S -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ! ^2 F4 ^6 z$ w8 I, H. ]
6 W# z) K6 }+ ~. z 不停的ping地方主机,直到你按下Control-C。
* Y3 o4 U1 ]+ ?
i+ J7 Z7 F( D6 u# j) F 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# f3 c8 Y. E i3 h2 y
4 {$ H: H$ f/ ^. F* u: j* S -a Resolve addresses to hostnames. 0 ]' V) G: f8 f& p( }8 B
$ |* G% k& i# I! z" `8 Z4 [
解析计算机NetBios名。
4 ]; E8 O: T8 {) n+ | / }* e! V: B$ a% K3 s# s
示例:C:\>ping -a 192.168.1.21
# K7 f& r! \! b- C1 b+ A 6 q9 ` G% l" Y Q: {" A/ B" J, l
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 5 Q) n9 `8 L, e( q* e5 c6 v
: c3 C& ?2 E3 _% D( M7 H4 P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 H f" t% q: M& c6 h
; Q+ Z' @* Y V0 M; t, x Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ n' ]9 h4 x2 u8 P
! R( ]& o- f/ j5 X; D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 C+ r. z6 i% {# w
. F: u" o6 M) U. I& d
- a6 V/ l# ~, }; ^2 G, o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 L0 R N3 M/ M4 ^
5 r7 m0 T; e1 Y# J0 i3 j Ping statistics for 192.168.1.21: : L( a! C0 Z2 Y! G9 o
4 }2 t0 k2 j2 O Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 A$ w1 U) j. O4 b# n 0 N, I L$ K( x; v. e& o" F; ~+ T
Minimum = 0ms, Maximum = 0ms, Average = 0ms
9 _; ^/ X; z& t( h" o0 n , x. o8 o9 R& S, r! |1 q8 t" y
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 & L! a8 j2 o: d- E s
; O" F; n( A# w: c% a2 c0 Y
-n count Number of echo requests to send.
& n) ], r0 Z6 e2 j/ V7 z- [% d. A
0 B4 l" `* W; w8 S 发送count指定的Echo数据包数。 4 H+ } s" ~+ Z. o& Z) y' N* S/ ~
* V, J# E' M# a7 C9 | 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 O6 X+ q0 s1 I' G4 \$ x, p 6 Q0 I2 R1 X* F# r" @2 U
C:\>ping -n 50 202.103.96.68 7 n) f. T% n% o0 p Q
$ ^. f1 P/ o, z3 b
Pinging 202.103.96.68 with 32 bytes of data:
# V# H& C5 x* o5 C+ @6 e- @
2 ?4 O' s1 l; H/ v6 @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + U6 }( r" n, P; @9 }" e
3 T2 l% n w# c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 R; u% |9 V6 |7 c' K
% e; g- u' e6 s: ?' j @7 p) v8 ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 e0 H4 c6 B/ y9 N$ q
* T; \5 B1 x& ]
Request timed out. 3 F/ o$ L3 [9 W* H* Z1 w0 X
) ^+ R+ Z; y7 \: C) ^$ o# F4 s
………………
2 g; w) G/ [& l4 Z& B5 C : K; v! d1 R: d) z& X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 t2 ]( {" _; t* N F3 M& w, ]
" {, @/ H- O, j3 |1 C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, T/ L, Z' I' c) Z# ?3 o 3 f7 C3 a0 G5 e6 k
Ping statistics for 202.103.96.68:
# C# `" v+ R g; {' @
0 G6 T4 Y, ?2 ^2 Y' h Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( w, q- h7 d. Q
: v3 H8 h2 ?* P
Minimum = 40ms, Maximum = 51ms, Average = 46ms
m5 x$ G9 x* z$ r' `# D 0 ^/ K! n+ z+ A: Z
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
! x0 y& t( V+ F
% x: F$ y" f% x+ Z& B4 f) k! q -l size Send buffer size.
9 j' g V% C- ^& V1 V+ A& O" r
& j* V6 n$ }$ l2 @) ]' ~ 定义echo数据包大小。 |
|