|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
. k" s" _3 M( m( `0 T, j& p
3 r1 N: ] G- ~1 {8 R8 w 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
, e3 J- ~+ W9 u, ~
2 r0 z/ w' [6 ~1 N9 w+ m 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 / y2 Y% W$ c/ w& @8 u) N) h7 Y
5 E: B6 \ ? d x4 G; V Options: 0 s: |) y/ ]; G. ~+ W; E, \
h0 |; q: y. A) W8 b& s" J. F
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 j( M7 C N# [3 ^
9 o0 {& Z1 d, T% l. y2 y
不停的ping地方主机,直到你按下Control-C。 6 U* \3 b+ ~: a' }) d0 V
/ [8 U/ \( w, a5 ^" W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 }9 j2 r7 E$ m/ X/ `3 s
; g& b/ `3 I7 N* z2 S. L -a Resolve addresses to hostnames.
! }9 g M) k; y2 m& G3 P 8 l u: T, }) A$ @) G
解析计算机NetBios名。 / R& c0 t: C! X; Q" o/ g
1 g7 [' j* [7 a 示例:C:\>ping -a 192.168.1.21
3 T/ O/ b1 X7 C ) C- O1 X8 g' _1 m% `+ g
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % q. F' P7 K: J4 Y x1 K
; i( k K7 g: V8 n y: Z ?) C% P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* w6 P% \4 h2 h0 ]- j7 K# R / d- s" h' P' [. @5 E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 `+ o0 C8 E; o$ s: W8 Q- i5 m
6 s3 _9 h/ Y4 A& q: I9 t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 |3 c4 J; t8 ^2 S
. w+ ^" A* q# i9 [- i * B- v9 { `+ }3 `/ f/ m' x. G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 }3 c) [1 D) Z0 P. N& D4 J / L v* v1 d% m* A
Ping statistics for 192.168.1.21:
" u0 b1 m& L9 ]" r1 y . I, x/ ]; K$ U) D* v/ L( X
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
7 _, E% |# S3 v 1 b% Y8 a( g; T% p7 n8 a3 [! p- ^
Minimum = 0ms, Maximum = 0ms, Average = 0ms
( Z9 L0 ~$ S2 h( n9 J2 v. @2 M 9 [. H/ C9 o: j n
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 [ ]# v) _) ^5 U
: Y. _* _% S/ U3 l/ A
-n count Number of echo requests to send.
7 R4 S1 A3 W3 W( S' s) E7 u 3 P4 @. p! ?/ w9 ~* |4 S' q
发送count指定的Echo数据包数。
, c2 d) z3 p" x0 S 0 ^* f/ e( r4 g! l% o5 L) {
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( }5 R7 T3 e) V. U% V1 B
1 w' M3 ?- c) H! c) `$ J! h C:\>ping -n 50 202.103.96.68 - o# B( v; J- K) q
; P7 M! J+ w' f. Z' C' W2 b
Pinging 202.103.96.68 with 32 bytes of data: " [7 S/ K, K6 c
4 B' K3 z g) L, V' \5 T; b7 B1 _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 O0 B3 z4 o* I( W5 m1 j 5 k; u$ s% r3 G
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 L$ ]- u; f9 @: n$ | : x& U# L3 z$ T! R3 I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) H& q6 ? z9 |+ y. D$ o5 F' c6 Q* H
5 u# x+ x. \5 W$ x; V
Request timed out. , D0 m+ a* X) ^: w6 ] i7 V1 s7 l
* U6 q% j" w, G ………………
7 D' s* \; d$ d. d7 u
6 r0 S: W" e- q7 a, D, I9 M6 Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / G! x- X0 V4 l& s
. m( D0 `9 i0 P) j) n& b/ x! w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . m0 I' J ]% @% p
1 b$ d1 J" W0 w2 H& \6 d/ r Ping statistics for 202.103.96.68:
9 j5 a7 j( j1 R3 E
, _$ X) O& }! x& V# c. p Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( r$ q1 z0 ~" e& R5 h/ [
5 F* @2 L' u9 R0 p& R0 ~
Minimum = 40ms, Maximum = 51ms, Average = 46ms
V* m1 _1 e4 \! s9 B; u C v ; L+ r8 g! f/ l) f! b
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 k# k; g! D# s5 N A& K( I1 P
( B( U8 a% G+ O+ A- n) W
-l size Send buffer size.
- p6 {2 @* A9 J4 l
, A$ x; U7 l1 a J# C: { 定义echo数据包大小。 |
|