|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 _+ ^) p$ A* S5 e- m7 S' L% P; ] 3 L# Z3 u D) K! H4 \
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ; ?( \" [; f- d! P
2 S3 }& M! e$ G6 n( f! s- y. b
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
( b6 w) u& k5 G5 D# d 4 C5 h- p+ ]& r) z& J5 t
Options:
3 ^( L6 A5 y+ ~3 y$ y$ w - y! i: k. T' j0 |% }2 B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. " z! z& r. l& T! T
$ X5 v% }( X0 G2 Z! d
不停的ping地方主机,直到你按下Control-C。 ! c3 ]# y; B$ v
! X, q6 J# ^; W# ?( Y |& v 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
: V( R2 X! U; R; S% t T, ?+ v ' F( |9 p5 g1 X2 I0 m+ L
-a Resolve addresses to hostnames.
4 c( M% |7 r- T5 E5 X4 {1 z / q7 B. G$ o3 D7 M4 y0 t1 y. w8 n. T
解析计算机NetBios名。 9 I% T5 E% ?* d
7 q4 ~# u2 P0 ^" R/ q# X0 Z 示例:C:\>ping -a 192.168.1.21 # v3 l. k: K$ i" s2 P- A; G7 [) N
' D* y7 z' v: u; ?+ B' z% `& K
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
?/ y$ x3 a1 y+ T' |2 Z5 u9 { I, Q- P* D7 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ A1 S5 d O {) l
. f) U8 y2 t: a t0 G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; J5 m* J5 ~5 `! R: Q* l) u ' C0 V; a% A" T, s6 @' V; z8 P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , K' [1 @. H! p: P6 C
/ j9 R" _4 G: {1 t; H ( l% A5 a4 I0 ~- F6 E
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 A; B$ `$ M9 o
7 O- S" Z$ m2 q7 w, F' I; V
Ping statistics for 192.168.1.21: 8 U8 m6 n4 s, n
9 b, `* s8 g! w3 [6 a$ p0 l Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: + J$ s; h3 r! O$ v, t* r$ B
1 e' N+ `( P5 U8 f: V) N' o5 G4 d6 n Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 j+ v9 K$ M- M# i0 i) i- t" Y ( q" ]; C. p. p' A
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
: J" v' ?/ G; k% g8 K6 _9 M. U 3 H+ W, k5 L9 R& J3 G
-n count Number of echo requests to send. ) t& a+ S6 n% J% g T" `
/ k0 m h+ m. F* Y# i
发送count指定的Echo数据包数。
5 U6 O4 P+ T! o5 H7 `
5 x3 o) ?: ]1 x! O1 l4 [6 R 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: , ^/ ~! t* m' C, H: @' G6 U0 _
" {$ x9 G9 F W3 |- d" B" Y C:\>ping -n 50 202.103.96.68 # h& {: O3 l; c2 z* @6 e; g- }
+ ~* w2 P: j+ K" Y3 \: G5 D2 W Pinging 202.103.96.68 with 32 bytes of data:
# P7 h( r2 E9 K6 C( G " ~( t8 L2 m+ J: a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . j6 V+ h- ]0 i2 y* Y/ z
, ?! N9 h7 o W Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / y- c; l/ X& c" b, k1 N- t
. B0 K5 I9 |. i7 G- ^
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* d& S4 _2 J0 o
, e2 |! a8 D2 E) O/ Y( Q: { Request timed out. 0 m7 ], L. z6 F! e- f
$ |; L& ^) i. G% ]) g# N
………………
, I0 r( Y* U, N" [ k# ?3 V
- B( N; Y1 v% D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; z( |, A1 |) h- h; X4 B" q8 m& [
# E& w8 _& {; g! R5 J0 y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 E3 o: n& S7 M. J
3 U+ N9 p5 S9 Z) L Ping statistics for 202.103.96.68: 9 y) H' S$ k" }6 l3 ?/ k& W
`1 |' J; y& @. N5 f Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 6 p; {) t p; J3 J- p
, y- G4 ]$ ?% P% Y! ` Minimum = 40ms, Maximum = 51ms, Average = 46ms
( |! N% k6 P2 W9 p7 T- d$ }# w) d 3 \" }: X6 ^- _
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ) U/ b' H( _9 G4 f; t
# X8 {6 @) m1 l( r3 b( r -l size Send buffer size. 6 d+ m8 H1 J7 x4 }, H9 @8 L
/ d8 U( d2 J2 m" B 定义echo数据包大小。 |
|