|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
Q6 `2 n4 m$ B: D! T / Y) l1 ?: S" |4 B/ B
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: : U2 s' Z; w" i, i0 \: a, A
' _3 ]& G' i: G) e
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 ; v$ U1 \* ?1 E0 ~1 W. L
! r j" i9 m, h+ v. d1 }/ M# ] Options: ) h D- s$ N: I
3 B7 S# W$ S2 z2 w" k& T& W% V -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
5 k' z- g3 J6 p( M3 C ( [, X! m4 ^( p# J9 W9 B1 L/ [4 J! i
不停的ping地方主机,直到你按下Control-C。
& ^9 P/ C4 g6 ?( T) D0 j' P 4 b* H- S3 B% t6 L3 F
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 2 x/ v, @( ~9 ~2 c1 q; z
0 m0 r" D: {: e7 X
-a Resolve addresses to hostnames.
5 v- @& x4 M W0 g& x- [( L 1 o5 }) [8 D4 z2 _- ?7 B
解析计算机NetBios名。
' m1 V3 N& U/ e0 G* ^$ B' `
0 S: d2 _1 E4 K" [ F" f 示例:C:\>ping -a 192.168.1.21 . A7 E4 \7 h2 B' s* u6 ` d
& n9 v' @" r1 A7 g
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * @: Y$ P: U$ g1 P v
9 o1 B& x, j5 n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 h* v3 R' V& m' J3 @" A+ Q
$ w! K1 B: l3 d5 j* N1 I: {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 Q1 u- W3 l2 g) k( M( C
( U' P- i' Q6 @' T& E' _8 U3 F Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + W% m$ `( `& i- X6 B
" s& U- C7 s1 ]! R8 b
9 T+ D2 l6 b t- ^' ~% ~ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 a& U, C: q- p% q8 o T R
! r1 O& l- c: S4 W
Ping statistics for 192.168.1.21: # Q' j# ?- O# B b( [) u# f$ e
8 B6 z3 F \+ X0 B) p: |' K
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 1 B4 [# r! R" n2 ?+ R
9 `9 `) ^) r% w% p3 i8 A- u) ~/ o4 ?
Minimum = 0ms, Maximum = 0ms, Average = 0ms
# w [% Y' h* m- x; f; H; j1 T4 ? . a' r7 L. k1 B0 o# Z8 w8 j5 X( ?0 A
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 v3 k, e; C8 n
* W1 H* k1 M: {6 t+ T
-n count Number of echo requests to send.
9 q8 n0 g1 }+ I; U' ^ / c' t ?7 h6 e6 X' T
发送count指定的Echo数据包数。 8 T& r/ q5 }0 @. p5 x2 _: v
" [5 ?) p! l- ~4 T# y( m 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
6 h% u* z' r. ]* z( r8 V. T
+ A7 K7 x1 u* B# r6 U+ Z, e C:\>ping -n 50 202.103.96.68
6 h/ U$ Y4 y2 h' }+ T0 k& n" h W t
- o% y3 \# Q0 D7 w Pinging 202.103.96.68 with 32 bytes of data: & c/ B9 C' u. q' g! r% _' y
5 @' \* n' k( c5 t, Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 _9 y# F( D0 k; N, ?2 @5 W
1 G, i, h. f: ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + v) L t" { ]; X: z
# S! Y: n5 I$ _" m/ Z+ `# f Q8 k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ a- ^, ], S5 G $ |. x( T; l8 m; }+ i. I: l# o& f: W
Request timed out.
1 P& f; ]) d, h+ O% w: j5 \! x
6 W/ a# W" \7 \# N ……………… , U g0 X2 c: b/ Q
, e/ O5 t6 \- R( @' X1 V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 L# S" k9 g7 h6 g( B6 L% i; L
' z1 [; j$ C* e4 W$ R. B+ [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + e' B% R$ \; }8 N$ V
( n6 S, l) D6 I. s' f. X
Ping statistics for 202.103.96.68: & a+ ?2 m. E( b
g7 m& e2 c; c1 N Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & w2 f* u, T2 P0 h _
( I3 r' J9 w) j) B( h3 w7 e& }3 \" u
Minimum = 40ms, Maximum = 51ms, Average = 46ms
4 ^# Y8 } D6 [4 g1 U7 S# w3 f2 R9 I ' T9 G: u- Z6 G C
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
2 \6 [, @9 } M. T Q2 M' P2 L1 y' Y
-l size Send buffer size. D8 ~8 R+ y B1 a! B1 }- v- S
+ j& h0 ^ G; g7 K 定义echo数据包大小。 |
|