|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 X! L/ O0 h' i& E
# [/ t% q6 I$ K, b9 b 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 \, H4 _1 Y) J& M( l
' Y' X2 e) F: T+ Z0 x! H 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
1 X) j9 s r% o1 ] 5 `& p, R, E5 E3 e
Options: ' f* P( W% L* g* b/ j
' D/ Y4 U- F a
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 _+ S* Q5 n" y. M2 Z1 [" B3 Y
( M! u" C5 n* c; e0 K2 ?7 X9 q 不停的ping地方主机,直到你按下Control-C。
$ t. i9 Q4 Z" I3 o/ P1 f
# e+ s- o6 }. c3 k4 C+ N' Y 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ( b; ^( G2 {8 O4 w% r; |# Z
1 N% M' ?- Y3 x- J$ O9 l4 a( K
-a Resolve addresses to hostnames. % c/ h7 R3 }+ B6 x3 [1 A3 k; u
$ i R1 t6 i( l, K( O$ |5 D4 d! Q 解析计算机NetBios名。 8 Q" k$ {( k3 u% M4 ~
" R& z _) Y, \; S5 e4 F5 ?# Z9 e! \/ v# L
示例:C:\>ping -a 192.168.1.21 " p# k. {5 _/ |
0 A, w- ~, O2 P- G Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
) s1 K7 D' V2 a* j 8 s2 K4 f& E) O" t- K3 h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : X" S/ }2 X2 t9 `# q7 q. f `+ _
* X( v/ [0 Y, \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, }1 I9 x9 K1 \" G2 R& {6 \
% B( {8 T) `+ l$ d9 r% i$ e6 K. y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! q3 `) `" ~2 _+ P# }# p: i/ B8 i
( E) ]+ |1 ^6 U1 s# Z
; \1 i0 I/ P+ w- z# _; x" w& s: z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ Z& U7 u) @( m" i5 }; j/ Z) g
! l, d& i5 k' O5 z( ~ Ping statistics for 192.168.1.21:
$ N; o- ^2 s4 a. E 1 D4 V9 X& T7 L' v7 i8 z9 `* r
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
$ i t7 r. L- P6 ]
6 [0 k Z! O% F- E3 F Q" Y7 X6 @ Minimum = 0ms, Maximum = 0ms, Average = 0ms
+ r2 n( n' c. E Z \ U1 E# }! p
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ C; {$ V, j3 t$ z* S, R
# F8 o1 H3 V7 C: O" M6 q5 h -n count Number of echo requests to send.
}' Q7 S- E$ j) ]' R Q, T1 O. P
/ f! I1 U% z3 U( N% Y 发送count指定的Echo数据包数。 A% y6 l: ]4 d, U
* F# W4 V: e6 L, U7 T, j
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 2 w+ n# n; a7 }2 V* I' C
5 ^: A( Z o( L/ s1 ?, F% j' M C:\>ping -n 50 202.103.96.68
! D4 x& [* C5 v# Z% ` ~; G: K) q
8 z7 \$ g# J0 a% ? Pinging 202.103.96.68 with 32 bytes of data:
9 v% Q8 M+ [4 }! ~ F; R1 [
2 `. i) M/ V) L6 B: J( q3 I: C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
r5 t7 Q/ P- @( x
6 E5 }9 ?; Q4 ~; H$ q( f7 A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: o7 F n3 Q& G4 J3 m 1 y* C, }1 H* P+ X# [# \$ R- O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ z) N% R9 y8 m) D# U, e
0 S* W4 L' P" s4 C! k Request timed out. 8 U1 j0 _6 X) C h5 @. p" {
# e8 n: ]% A0 ~
………………
* t* a3 B6 o* d! R; d X0 I4 ^ e" c6 r7 z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; [$ v; N$ I0 O8 \7 ] 0 _2 U+ W2 E& D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( k# n2 S; T; A
) x# `) \' H! L# x/ B. n6 u7 m Ping statistics for 202.103.96.68: 6 ^5 T$ L! n( k# F2 `7 U7 X) g
/ O( d2 n% ]3 d$ P, T1 S6 l' d Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: + ?, Z1 r( o) f
" v$ m) n* _+ [, V2 a Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 t+ r; U6 c' r' K3 T
, ~, D/ p3 q: `3 O9 N8 X0 M 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; V: m. a) B9 U5 n
$ j" Y0 I8 q& ]9 R: ?8 n2 s) Z
-l size Send buffer size. 8 v9 O% l& O, E, W# h C# K) O# p/ m
, l" f+ ^" U: W4 c4 J
定义echo数据包大小。 |
|