对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 4 C: \6 q% ]& Z# F% S. ]: g9 Q
$ H) d- N& y% _8 |
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # l0 J$ Q( u7 [6 N 8 @! R% A/ K+ O4 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 9 [* I r2 d6 S. b1 u( ~- j 7 u' ^+ z3 l9 d2 n Options: 0 e! q7 C% J, w9 }2 E5 S . E2 C/ O: l* g5 B4 M3 ?. Q( V/ C -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - d% N p8 B. L- S$ y
. y. A0 N# ~' s% F3 O
不停的ping地方主机,直到你按下Control-C。 ! f8 r3 ~- a- a1 o% \" e
o% E- Z( U- [" o% z- n% V+ H8 v
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 b8 g: u9 g4 R6 h# T
! p. F p& Q3 @
-a Resolve addresses to hostnames. - r/ G6 e1 n2 l" I; n
6 ]$ b) w; O0 R4 P
解析计算机NetBios名。 1 n* @0 Y" @8 z/ ` $ z$ R2 l8 ?, k( t/ ` 示例:C:\>ping -a 192.168.1.21 : o, x3 K% ~) K2 ~# k, B8 h7 O
) f( R5 P2 n0 [1 r) D, { Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % X! d# M. O c. v' q- H # L$ h q4 B4 _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 @1 V, J) `% y; G; e / q$ v) S2 c! u g& a* U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' C! s) }0 N* E' m; l
# x: A1 ]% n9 @+ w3 { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % |" H: n t% B) Q5 s1 Y' c! l b! D) r' D9 ~4 w4 L
) U4 n1 i# D8 d7 E4 `' [/ b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 `4 [4 t: z0 Z+ a; ?
' X+ g$ M* S( i6 a" g& y! V9 d
Ping statistics for 192.168.1.21: + c; S5 B2 `% @/ t3 v. z, Q6 k " X C- m7 U+ c2 g
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 }+ o% e4 o% B! g& _% y 5 W6 A) x8 g! {- w Minimum = 0ms, Maximum = 0ms, Average = 0ms . V# \3 W: N! S% S2 h
" [ u# @" ~% u% O) \3 }
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ' x- d# `; s* y6 m% O* I
2 v. Q- a: z: G0 Y! V
-n count Number of echo requests to send. 5 \' d( t' x0 ~ % u- H- A' A$ B5 [ 发送count指定的Echo数据包数。 . w0 L/ C: ]) s' m6 s9 W9 u; u & x5 p% r" Q" F3 E$ [ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ! [0 S3 j+ d- y& U ; L7 h$ Z2 K( _/ _; f# `
C:\>ping -n 50 202.103.96.68 / |& u/ [& C2 }8 z# ^" Z# q* n
" w2 {+ B% e9 n# s2 n
Pinging 202.103.96.68 with 32 bytes of data: $ i, i! o. p2 r6 w# ]# b
3 B; w8 x8 x$ b$ t# `* _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 k: ~5 C. l. o
2 k$ c+ t! H7 Y5 O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 s \5 M/ U N& t4 [