|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 V' k3 j; X- Y
1 I9 k2 N9 S' K
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # q# p' y7 x/ L8 @. w @$ O
! z4 J* T4 b8 n5 ~
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 . W2 ]8 c2 ^( T
3 Y& f- L9 X9 s2 Z! r Options:
0 q4 V: ~6 ^% x* c' r( @" e
! e" k+ e0 u* Y -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. % O* V/ ?5 v2 F9 N
; X1 v+ P. }7 q2 I! g8 g3 M' W4 V 不停的ping地方主机,直到你按下Control-C。
7 l, O8 y) u3 X1 t2 x
8 s1 ^; N5 |: E1 f4 V! r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" N& ]% G: z- B3 O9 E' L/ A H2 `* E+ P( |! i; {, `7 v" c
-a Resolve addresses to hostnames. 4 r- ^6 j6 h) t- V
% R8 o9 Y8 o. }0 U$ Q 解析计算机NetBios名。
5 U+ v# }$ z0 x. O1 l, d6 X. X
* v. `* p4 N- I J! ?- ?5 S. I 示例:C:\>ping -a 192.168.1.21
( I% n3 `; U3 A3 r* F0 H: y
# h1 }3 F; d& x8 `1 O Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
; ^2 h* e+ M2 x! A( |
, Q# T2 z; D7 w6 o. I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) y/ w: H# P$ x7 o : @: c0 h9 k2 p) S/ o
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% I5 I2 ?' B( ~/ T; M ! U3 g) l4 h3 y- ^ V* C2 ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' B% K% ~) R9 j' t2 e
8 z4 s2 A f! `" R; x
" U1 [' [' H0 s: s0 { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) y- e; x0 v- x7 s" Z
. Q& q: Q0 K$ I$ s+ j Ping statistics for 192.168.1.21:
5 r& F6 n6 ^4 b. P) z0 r: { % _# R7 u, T: A/ ~
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
8 ^% i) E' v& y. ^ ! e/ v. b$ w! W6 z$ P# C) F. X" ^
Minimum = 0ms, Maximum = 0ms, Average = 0ms 8 |5 l6 A# S. }# v$ y/ E
- ] T" \* a7 z) V X8 u
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 i) d- b5 p6 M; O' w5 w 5 Q# J& V; o7 c G/ e
-n count Number of echo requests to send. " | `* z l3 ^8 o9 u/ [/ e, G
n) ]4 w3 Y* D; H- r 发送count指定的Echo数据包数。
+ p% {+ N+ p' Z$ ^" d( {
9 ]5 i7 J: y7 a. O D5 c, d1 A! f 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
2 P+ H7 g% ?, W: C - D O, K& y; w7 I7 W8 K O
C:\>ping -n 50 202.103.96.68 ; x, n, t' C1 A0 S, {$ D
9 s6 i7 A9 r$ \6 g/ r8 `* N Pinging 202.103.96.68 with 32 bytes of data: * a1 p. u, t8 k3 s) W
+ w& Y8 Y; I1 @4 z, C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: F0 z1 ]6 T9 H
" M4 y$ P) x& d1 @ F; r9 w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 F; x0 W8 H* q" ~
( @ x1 B3 G: o7 [& A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( h8 J( D3 J$ b0 W" _( q' M$ y
2 N1 g% Q r. s; Y1 {3 B$ V: j Request timed out. 4 ? ]% W! h1 T- Z+ L: G# Z
0 X2 C5 {8 _. I) @" s1 p- z ……………… 3 ^$ t, j* ~9 A. g- f/ S j
( J4 [; W. f. A1 H& N( x Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) F6 {# `7 B* j9 n0 H! w - ~, |, T9 `4 P9 S6 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' u- W5 N5 v4 @; t
1 Q% O" \8 U# l6 y' O
Ping statistics for 202.103.96.68:
6 A" c! M% l( r% o0 L ! `0 j! g1 ]3 b3 ~0 O
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 7 N1 w V+ V; I. T" ^" T& x
; @3 }- [9 f# u0 n1 y Minimum = 40ms, Maximum = 51ms, Average = 46ms
+ M0 m- ]% ?* H% ~( s " f' A4 m# l8 f2 r( H
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' e: N6 z% s: e4 V" E
$ M2 {. n5 G) P; T2 d L6 ^
-l size Send buffer size.
! R, z* ]+ k/ l F% f- Q- A
/ H3 m @' L9 C& U 定义echo数据包大小。 |
|