  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * _% F0 `$ X* @7 ^, |3 |% H
2 d/ e l, I$ I, m I/ d
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ F+ B. O4 r1 O+ o$ @
4 v6 _& C5 g! V$ B" 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 ( k6 w$ D, c6 z8 u
' s6 b" W0 K7 C Options:
) G2 T8 ]3 o$ H8 `' D $ b+ ^% W5 M' Z+ b
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
: U' X% r+ ?( Z! R 9 T) d V+ @0 j+ E9 _
不停的ping地方主机,直到你按下Control-C。
8 Z- V! Q5 `& v d0 t8 f- ~* k9 p( \! w# Q
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 5 b# E: {7 A6 A9 R; T
( G' \) ~' r+ X- n. s5 r. l3 _
-a Resolve addresses to hostnames. 6 b8 k! N9 _) M2 F! }
/ m; g( d7 f8 p$ F/ ? 解析计算机NetBios名。 6 U g" P! h. x$ H9 U* R
, g& ~0 x8 `; S" V+ q5 g
示例:C:\>ping -a 192.168.1.21 # S' g" @3 B$ m3 M- u
0 Y2 k$ Y/ s. R( E7 h, i# p
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
) o% h* q8 e1 n+ _0 T% v b
# `- u, m4 Y5 _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ Y# h7 t1 {" y/ q
4 P5 Z1 x/ a- j# F! Q: B) _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, \3 ~- e3 U' m: M; w3 x9 r0 ]% C
, f/ [$ I5 a3 E1 l0 t( y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ i4 c$ D* j# K4 l: \1 @# c2 Q1 X
3 D D7 c5 h* \3 B2 M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 c1 W0 w2 D- V$ B9 J, v
+ C7 H" B% u9 F7 `* K/ S
Ping statistics for 192.168.1.21:
* t3 _" C3 a- z3 J
7 ]. A" Y4 J' w: O8 m' Q Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ' U& ]! D8 d' o4 K q9 S
M3 S: n: W2 K! E4 l+ h @% ] Minimum = 0ms, Maximum = 0ms, Average = 0ms # ^/ h. a4 b& c, Y4 H
2 J/ p" w" x9 T& b6 B
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 B' W9 r& W" E/ D8 ~) Y( ~' s' N! C
. U- _% _5 s9 D% `" q0 S1 n. H -n count Number of echo requests to send. ~& B' ?. n a# R1 S7 m% G4 r+ a
6 H; B7 c* q* W4 M- t+ v: E( } 发送count指定的Echo数据包数。
) u- \0 L; P z! t' M ( o3 g! A, r! m! _ H" b+ \3 }
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! p Q# U# w/ u
7 ` B; i. a0 W6 V/ P C:\>ping -n 50 202.103.96.68 ( n X8 }2 C/ G4 I
9 N% g/ o$ H( h0 a3 A3 F, Q# H) p
Pinging 202.103.96.68 with 32 bytes of data:
$ l. I: S: i/ n/ ], @ " c! H6 ?9 G8 \- N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 a# i1 a5 v2 V: Z- B7 G6 s
! e8 m8 Y7 w% W* D, F, v& w0 Q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * \7 V- t- e3 L) ~
# Z: R* U# ~7 \2 a( f5 S6 o Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( j+ z' R, ~* Y
5 q# X; _3 b1 t8 i
Request timed out. . Y$ w7 ^0 s, d0 v& c
8 F: v6 O; p; l+ ^: | ………………
' T* @, o! `" t5 B/ o; Q2 l. B
4 Y$ F1 D% t$ O: P0 b e0 e# d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " M. A( o f) t5 z9 q
4 h ^' g& S. o7 P% E Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 ~+ P1 B6 O* S- k
% ?. P, o0 p2 d/ b( \
Ping statistics for 202.103.96.68:
$ F( p! h v9 [7 G6 Q% d : u6 s& o( D' @9 ~
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , ?# K A U! e
) [$ n$ |" l% a+ s6 l6 a5 W
Minimum = 40ms, Maximum = 51ms, Average = 46ms # C# s* \* B- U* q
$ p! h7 o8 V& }% a
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
' b0 o, p8 ^1 Q* G" q1 e9 Q % w2 E$ V# P8 m! F g1 `! p
-l size Send buffer size.
* O' ? u- I5 {" { 2 m4 \. [* l; d* G+ b: l1 s, k
定义echo数据包大小。 |
|