|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 , v* b0 X- ^5 [
. ~1 Y8 k' \& N: b+ \# s& H& G$ S 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) C) m2 z: X. N) M. j; R" c " h6 d' h. a* b# E2 a7 X- z
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
; |6 \$ c4 S9 t" p- ^; f
. @1 R- U' N' g Options:
+ M% N1 z, k7 [1 K5 p& \ ' I9 k0 f+ @( B5 |/ a
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 T% Q. `5 }5 T$ r- B* D
6 F: x7 K, }# r' O- o 不停的ping地方主机,直到你按下Control-C。
4 a' E) M6 s) W) A1 I' g: i 2 N0 z6 s. J6 O2 c& D
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 1 {* J& @. t5 {
5 P6 b+ _/ v7 r0 T$ J. l$ W# _( c
-a Resolve addresses to hostnames. 8 n. M: h# ~/ x3 r" r% N: h
1 J* ^) [% u- d1 b% I! K1 N# G
解析计算机NetBios名。 7 Z6 Z, ^/ U# A5 p, v, o% S
7 ]5 K8 w! l0 G6 e9 [8 O
示例:C:\>ping -a 192.168.1.21
) f# P) A) p) l0 O( d
* V% Q! J3 d8 y2 }3 t Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ z* z4 F9 C& ]& Z: C
' _1 @3 u6 b( Y0 d* G" T% I: ^! z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 H$ _3 |2 @* H* U$ u# x; \ # y; {7 M% N$ |5 a7 Z8 J5 w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 s X& N( S; x4 d; m% ^0 A ( ?, I ]+ W$ d B' K% \& ?8 T* j$ m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 F- e- I+ a0 A2 C
1 @% y+ U% d K$ G5 o# h% }9 r 6 f- _6 { r5 X0 z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% ?; ]' f/ B- E- S/ j2 v: h * F7 w' I9 \; b, u3 o) Y6 A
Ping statistics for 192.168.1.21: L, B: z$ q& p
$ ? v' C8 b+ f; C d* Q" T Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: & j, r( h; o6 C9 W3 n" h
( U/ `: @7 C8 M# F. v( r1 @ Minimum = 0ms, Maximum = 0ms, Average = 0ms
! e3 L: Y- |9 I( B8 l: Z! |
2 h7 Z3 t! ^7 L, Z1 e. R 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! F6 L) f8 c: w
: h- _# m" N! |& @" F5 n -n count Number of echo requests to send.
$ _- X& c$ V H1 A( e: s " y0 V) C" c: o! U, g2 f Z
发送count指定的Echo数据包数。 % f5 M/ d8 ?& G! f
. A( V# j2 L% h t+ o* b5 ~. C4 l8 j 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - A& w9 V3 W" y& ^; \, A
$ t% ]1 K& K! s: N
C:\>ping -n 50 202.103.96.68
! B/ p. j- e" l" q 3 `) M+ T8 I# b! o7 n6 X; a
Pinging 202.103.96.68 with 32 bytes of data:
5 ~3 g- o1 ^+ I . D/ M$ R( A1 P# O$ s/ m! o
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 ^% F8 `( B! q- J9 p, M0 o& E8 w 4 [. A; X. ?, ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 z9 f% g; ]. L: e, x
7 D6 E7 y# z( P) z$ e0 [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 r9 U# A d5 O0 y& j/ K3 P 3 k& L1 P# \, s( h# R
Request timed out.
% Y; f) e7 T6 i0 `4 K
3 x9 @: J2 A4 V$ ^ ……………… $ {) p* K2 d( |& j. C+ H: ?* w+ x- T
/ U3 l. i4 Q5 u% l2 Y* o
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 J6 a% h' V* g y% t' d' B
& i9 w- Y9 a7 E6 s7 s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 @, q, s. L; r
! s7 H% X* V1 @4 o# G) o) {* B Ping statistics for 202.103.96.68: 6 ~' [2 a$ s- j; m% }- W% J% [
2 I) }. p. P1 n1 E6 @& Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
- i/ D# o. B5 [- x% w6 ^: j 6 y" `4 C0 p6 x7 C9 m3 r
Minimum = 40ms, Maximum = 51ms, Average = 46ms + s5 e8 {( }2 e! I$ T
( d8 J; H. b+ Z3 S7 y
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 , w4 Q& T' a# r/ B% g' ]
$ o. j) n. G6 e1 }$ [$ Z! f -l size Send buffer size. 3 v6 @% I. P7 P0 A$ [- c' t8 v6 y
; d( `' G& I4 [ Y' y. ~ 定义echo数据包大小。 |
|