|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 " M/ N. m T! g& O2 f3 P9 x3 E2 ?
# c4 T2 y+ q+ p 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
4 s- q8 }% G0 T( q& w0 b" t 5 H7 q7 f% k; g2 o: T
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
4 Q% q; R3 v7 u: ~1 l ' n% ^* t! o3 t( i* z" a
Options:
$ b% ^! u/ B0 G* X9 _! G5 C' }8 D - e% G" `/ q: F
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) ?1 K) i' E0 ]# ]9 b) S a9 o2 h& z7 ~( y
不停的ping地方主机,直到你按下Control-C。
! i! ]# ?5 ^5 L2 H% N% U 2 ]0 Q1 c" K- U# o* k
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 ], C3 `! G1 D3 J
* @/ p! T! Z( I& j
-a Resolve addresses to hostnames. ' D9 G2 U$ ~6 ^
$ L/ O" h$ L/ A& }- Z4 } 解析计算机NetBios名。
" ^1 E) a: q% J* S4 a( S: x
( G, |; A$ ]/ a. B- m1 R 示例:C:\>ping -a 192.168.1.21 ' w# G% G5 t8 [- E
3 P; L% }- F5 W4 j1 Z Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 |) d2 I- ]+ D0 {8 n
) A% y. l" Y" h$ H! I5 M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- l, I9 V' B1 g2 Z* y S# `; A% \
5 D, c% s% I; I" d) d0 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' ^, Q1 t( {9 B+ P9 |6 x
$ O5 f2 X/ Z- d) i& Y% N; r) Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 M: \4 R: M. `+ B3 \! v
2 g( R$ p" j0 w) g% S * V# _5 v- _9 H2 U6 b/ r+ e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# e: E# y9 X% Q$ t- F* z# q4 d
3 s6 F- T5 Q {3 e$ S3 B Ping statistics for 192.168.1.21:
) r* T6 ^0 {6 @/ o 4 }" k9 V! Z: g
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
& c( Z4 ~% U( s" i
, Y I4 _6 @: G3 g- X$ `- t5 K Minimum = 0ms, Maximum = 0ms, Average = 0ms
* `. r6 v2 ?: _0 ?$ v( d$ N . h8 `$ ^; H$ z3 Q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 C8 J' K! X6 i, w0 A) B
/ \. y# {8 t) D% e -n count Number of echo requests to send. " G* p5 @. T/ z+ c! y& W. E
* k. X3 I+ @$ e3 @: Q9 N0 h) o- q! C: U 发送count指定的Echo数据包数。
) q9 k5 |! r f c
3 }7 E2 j) `) R$ u- s 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: K* j# ?* Z/ E
7 A- |, A. S3 ]
C:\>ping -n 50 202.103.96.68 3 l' P' J$ K9 j/ ^% r }% {
, v& y& s p5 s4 `% ]
Pinging 202.103.96.68 with 32 bytes of data: 1 g% Q4 \( e! J
b6 p8 H; m8 \, X: ~# ?# w3 s" k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) I3 A8 w+ l5 r+ R+ F
) R' i. K6 Z1 R3 j* C: y! j, q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 U Q6 o; Y. L8 d& b
( M$ e7 Y7 W( P! s e, |! x, T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( k: T. J' |. ^
& @5 q0 x, R! w* ?/ D8 L2 C Request timed out. 9 T( B6 G, i: R3 O0 }6 H
* ~( a* Y+ T: [, A$ I! i ……………… * V- ~: ?* U2 U3 w3 i" x2 r- h! j
0 p5 d1 a# U: h8 F: g# o2 j1 O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 G) `+ x( Y q ' ?- _; S8 {7 r& Z! x, ^- |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) J+ S4 G! s9 i
# A2 E: b: M( ]/ l7 e% i Ping statistics for 202.103.96.68: 6 q, [! {& @/ m) u# {
D5 @+ \) j) J: F: W
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
+ j5 m! F' g4 j- i: V! h
! U/ q, K5 ^8 P- K" w$ W Minimum = 40ms, Maximum = 51ms, Average = 46ms
) { L4 \7 i# c* Q# @8 B+ F
- b8 S* W3 s& P9 h) j I& J# q 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 S N, Q0 F9 N
' c7 s5 `( }6 I4 H# G( J* A9 e
-l size Send buffer size.
. a% |3 W( z0 V1 b5 m5 S : `: S3 ?& w& f) W1 ^) o# h
定义echo数据包大小。 |
|