|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! g/ V& h. D2 T: K4 a5 h' t
' ]9 H6 ~: f! d F2 ? 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
7 b) }' G: e& Z9 }8 a! j 7 t1 I9 k8 {1 {
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 b8 U( b3 L9 }0 U. v7 j
- o+ s* a1 Q d X1 v Options: ; o e* Z" K, n
2 u4 C/ D3 O( |. \5 \
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
_9 A6 D+ {3 k5 P9 E
- ?4 t5 q5 ^- c1 I/ j 不停的ping地方主机,直到你按下Control-C。
% s8 z# j0 P1 K; i0 f# i* H$ D' | * e& ?% j$ V( o1 E* {, {
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 5 p8 o! ~2 D8 R+ g% Q$ t
/ j& d$ P# {3 w. ~ A- }
-a Resolve addresses to hostnames.
) w: {+ A0 ]7 B" R
: a, D2 C8 c m+ _. Z H 解析计算机NetBios名。 + R+ d( P5 R1 f
8 v- G6 h. M* l, \9 }" L# c
示例:C:\>ping -a 192.168.1.21
/ Q* j# h" a3 ~! f
. s8 r6 W+ f5 i& D9 u Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % z' r. x6 V5 E+ |9 j0 o
! [) j' H3 u0 S) Q% s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 m; Z2 ^1 ~/ J# T# X& c" w% I: |
2 L: ^7 s5 O5 D& u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; Z% b" E0 A9 m y 6 E0 S0 y* q) S. o, R4 r' O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 ~' `2 h) s& ?: K$ S
6 ]- f# _9 ]( R
$ [+ R, F' y2 O! j/ w" Q" f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 e6 b' o& K+ a6 B - J$ [' |8 O+ O/ G! U1 a6 C' ]
Ping statistics for 192.168.1.21:
L! L6 U; H$ M, Z' A2 f, _ % O- g8 o: @" t: s! p. Y
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : H+ \) U7 }0 K& a
% a4 `1 y9 I" X' I Minimum = 0ms, Maximum = 0ms, Average = 0ms
1 k9 u& X. @6 g
7 c% V; r0 ^) }' m1 ^: i2 D+ N0 }2 [ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # u3 U# \ Y( u3 A" Y
0 J/ O0 m& [- V& a) P0 U -n count Number of echo requests to send. 8 r. h& G- M5 o+ \% M% X
. Z7 Z7 m6 L% |, S* ]) z. S7 I
发送count指定的Echo数据包数。
9 W u% w4 G) T' u( {
6 z. V& |/ n4 I! s 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* E7 B% C2 K% }) v 7 G( S. I; U0 ?5 N
C:\>ping -n 50 202.103.96.68
. j- _" L) a& V; \# S 2 V8 N! Z# k# z& e G. q. s7 q
Pinging 202.103.96.68 with 32 bytes of data:
! b$ V* ] b ~$ p& l6 O1 B8 X* V ! C; f5 M* v1 h5 z1 u/ {: U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 C; S: q) s% O, a
6 [+ D- D/ |7 O# ^! w( N/ i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 `6 S# k8 q8 M3 S7 [
, Q8 n: F+ f6 q) o- P8 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! `7 O1 |" g* W! U" ~6 ^ V5 Z 4 Q# f8 r) i4 g- H, u& {# ~
Request timed out. ) c* \% x* s5 i
. J$ n# h! {- ^' F ………………
8 M% v" G/ c8 A . S* A/ x/ |& X* E) P2 |7 q, X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % d4 J7 J; Q8 \6 H0 N/ C! o+ |% z
! z8 o2 _/ ^' H! q2 m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 F0 ?( `0 `; U
6 y% c s, ]# S; j0 a Ping statistics for 202.103.96.68: & M; f. d0 p( I# K. b
/ b, }6 L! Y1 ]+ \3 O) z: l" P/ n Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
5 e. w) S# G+ x8 s% I + i* M: @6 M" ?4 m
Minimum = 40ms, Maximum = 51ms, Average = 46ms 2 f4 q- Z' G' d9 n7 \9 B
+ C3 |/ N) Z1 l0 `0 y6 p 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 $ `" q7 ~0 d! f0 e9 S* c+ ^/ {
7 j3 g; {, `' t% B% y -l size Send buffer size.
) Q+ I$ n% G+ S
$ k" w$ d9 G4 [4 c5 J, f* s0 ` 定义echo数据包大小。 |
|