|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 _: J6 l% w! G
$ \+ P1 i6 z- C$ F5 c 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 M c4 Y1 u+ l( N
! F0 N8 O- H+ a6 t! w 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
+ Q# B% {) `4 H3 J 6 q8 c! n+ e. J
Options: - F1 P+ ?; [0 T. ]: d
& _( i: v( T! D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 }) ~/ |; }3 p6 a + q/ `5 x- O' f& z$ v* w& h2 @
不停的ping地方主机,直到你按下Control-C。 8 x: z( ?- t% F0 d* ?
/ l3 _/ b1 s0 c0 N0 A8 d 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 7 T* Q- M! _) g; b* ^
# b0 K* ~. T5 z9 B3 l. H- b5 @
-a Resolve addresses to hostnames.
& |/ b/ s4 L. T& M2 Q
2 x4 R2 B% |' s; X 解析计算机NetBios名。
L8 G+ D+ k0 D8 D+ r
9 f( q9 L* C, I& i 示例:C:\>ping -a 192.168.1.21 ) ?% M, C- t% t( N/ _' F: n
$ }5 p: G) U5 } C Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 3 }* T9 z. j, e7 e/ G$ N
$ z% A" s K! t/ I- H% E. u# d, r! Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / l& D' f( J* p
' |& L( H1 {& x/ n1 }" ?8 A Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % k- b* P- O4 z$ o# K4 G2 A
* v3 m# t+ ~) |! H; M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 f+ _$ _& p, Q3 Q# P
5 p! M F1 y* O! K8 }; X5 \* a3 \6 R
$ N, Q a5 e ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 O+ v4 }8 L; b6 P! i P( d( A 5 R) n( ~) g+ Y4 h
Ping statistics for 192.168.1.21: , ]: @$ w; g5 y9 v0 n- Q' t; d
0 ^9 V, g4 O7 g, c+ j Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ w0 x- I! _' k
$ w$ K+ D2 a1 }$ Q, `& k m, I Minimum = 0ms, Maximum = 0ms, Average = 0ms 0 l, k. y( k; \& n
4 w5 j( v% y8 I: g9 P. S2 W0 L5 h
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 x0 r7 R& ~6 B1 E" m; }
, K6 R' ^3 u9 W0 I& L+ W -n count Number of echo requests to send.
' A, }; p, f; f / u' K2 o( w+ R) b0 b7 N, B& `% @
发送count指定的Echo数据包数。
5 z, S& K+ p6 Z& t5 B# @; i , n7 X ?* J' p3 T
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: + @5 G- [4 L7 K L; J' f0 P4 [7 a) c
% N$ `- K7 G. G* w( p. r: x& t
C:\>ping -n 50 202.103.96.68
( o# |- b0 [0 G/ c" g! |7 V( Z2 m6 O5 t
7 Y; w, u( s8 u0 p Pinging 202.103.96.68 with 32 bytes of data: ) s7 b2 J t6 f1 c/ m
# g, |6 f! G; A. Q& i+ e; @. c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + F1 i# J- @% O o! F. v
2 w8 h2 f2 Z" V0 @ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , m/ o- | v3 f- H4 C
G# e- W/ z! ~3 [2 p; H) \6 z6 E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& M4 `2 L C/ V' ~9 b5 F% \ + G5 n+ l) O' w
Request timed out. - W% u- W/ p% G6 E. ]% l* G+ Y8 v
7 Q) Y0 `0 Z [) i+ Z
……………… # g! a8 |' C b( F" p
# U6 j, x0 i' r! W( x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( K2 p+ _/ S+ ]4 g) r
( i( x$ S8 G9 d8 E" n) K, e+ ^$ w# ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; h ~/ v1 Q& S& f( {
5 W9 X% N! N- O$ t7 Y1 H. o
Ping statistics for 202.103.96.68: $ g1 F! z! c+ r$ {8 O3 }, b) n9 g
( S; f! a+ R& C/ b Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
% v: v0 ?+ o- |! V! k& a
+ L- t+ _2 Q/ r* Y1 o Minimum = 40ms, Maximum = 51ms, Average = 46ms , ~1 @2 @; o: |8 m3 a+ A s
% C# ^) n! R4 O$ O0 u. l: N
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 8 o0 w4 j+ X3 n* y; f3 A) c
8 z# c9 E' F% n
-l size Send buffer size. $ h' x0 H5 O4 ~ a f. |6 ?
( @- F9 D- y' Y7 u: g" J0 G+ ]( B 定义echo数据包大小。 |
|