|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 n7 ^3 A8 A' w" O; ]: z) D
$ u: F7 Q) B1 S8 z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ! b4 v3 Q( U4 a% n+ e2 J$ w
. F [4 w2 G/ e1 C+ w; a 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 c3 X3 W. U% O, e: K4 f. q: y
9 B! G! y$ w) N( M. X9 Q Options: ; t* ]( @1 N$ c0 A. @3 p
! b" t6 Y! s6 {: u/ Q7 ~ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
( C; M0 {$ ^. A" A* A7 h9 a. \
5 i! Z% ]9 L( P& W( j2 v 不停的ping地方主机,直到你按下Control-C。 - }% n+ _: w% A, T1 {4 C6 {* q
/ B( Q; g+ U2 ?, T: ~, f
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ' ~9 b9 T' R3 B( x" u. g
4 K; Y' v' N# b' g6 N
-a Resolve addresses to hostnames.
* X J0 Z, Z- @2 \. o \ ' v1 M3 F7 e) f) G9 ?8 {
解析计算机NetBios名。 ) Z% z$ M) K2 ?3 k. E9 }; A/ U
+ @1 `7 e$ P1 M4 ~3 L9 |
示例:C:\>ping -a 192.168.1.21
( J+ ` J0 k" v' X * K2 u* g; s7 |" c, X# G, N( P
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
! |1 v- L) T7 r- W9 U 2 M( g/ a" B2 D( W/ i, }. ~! r. F/ Y- t
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( r) |6 @2 r( x2 F5 o4 U
) Z: V! w' h+ J1 m) L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 x% [2 |, R! K7 s. O
. }% a* ]" p+ c; R6 L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 L$ Q3 S& p7 R/ o9 w1 O0 h0 x1 P# u) b4 R m" z: w
) q M+ K I: ?8 e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* H N. \& P3 x
( d& w% P. B4 k$ u Ping statistics for 192.168.1.21: 4 o9 y4 f, J) K8 `1 ?
$ h5 j# s! c1 a# R Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / X, s( C* @8 D7 M0 H C2 `- l4 f
" a, t( x& T- c Minimum = 0ms, Maximum = 0ms, Average = 0ms
) S- L0 ?! j, ]/ ]$ A
* c" {3 [/ |* ^7 i1 a* t 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 - A" j O: M6 `1 Q" V! f u
8 u# q4 `& B( p1 f _
-n count Number of echo requests to send. $ ~% R& S3 X* ^: d
' Y9 `: |6 a9 i7 A 发送count指定的Echo数据包数。
4 E0 q; S4 t3 R( ^1 N* [7 S& H
" X) ^! c8 {+ l. O- u* t 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: & N; F6 y' L2 I7 ~
/ M3 `/ _- w8 O C:\>ping -n 50 202.103.96.68
8 p( ^( d6 L8 |* t0 d* O/ b. k1 h7 d1 Y / k. ]' d& W( k! T( g/ T
Pinging 202.103.96.68 with 32 bytes of data:
1 | q. J/ ~* D / |, k; L+ V, ^+ B# J: B1 K$ w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) g7 y( K4 m" G3 S& n/ P6 a
u6 [, d6 y1 Z* L
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 n, H( L5 q( U6 J8 l3 ~
8 I9 s, ^9 Y9 o* {" s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
~, R6 C; N& j1 D) T& \ ' a$ a- [( q) F& t7 r5 R
Request timed out.
3 d3 C/ s5 }" K- A
9 }( l& u' Z( c) G- g. s ……………… 1 o6 Q8 [5 J/ z, Z2 C( u7 ~
6 ~: ~( W" Z2 h- i% ~! W1 T1 M, Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 o) ~! U; C! `5 L( @" M$ U
" j" g% ^$ Z# e: E! {; A+ |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + J7 u. L& x3 H! ?4 k
/ D4 ?5 q c/ i- S
Ping statistics for 202.103.96.68:
, Y* m( m1 D0 \/ g+ e, ?( a $ P% ~1 s# t& a$ I2 `' s
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 F9 ]' V4 D( S) j ( Y4 J. n+ T/ R4 K3 L5 H r5 b
Minimum = 40ms, Maximum = 51ms, Average = 46ms ( u' O6 d* x. y
- M* q- W3 x3 x
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 0 J: d: i# p3 ?$ I' M! n
$ B2 B! [" q; F% a
-l size Send buffer size.
/ k6 @# W* G% Y; b 8 Y- W& N A& `/ t# v% `) Z4 V5 B
定义echo数据包大小。 |
|