|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
: t6 k, k4 f* M! {" R$ a
3 V$ z8 ], Q8 i# X5 Z2 L( ~' j 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
$ P2 U0 \, l, ~% }- P& ^* q3 |
1 |9 W+ _- e2 `; [0 i Q) L- I 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 ' E2 o$ y9 i2 {1 T w
: H l& a. u. B$ z( }" @$ s% }
Options:
5 M9 }7 c% \8 W' @: K
2 Z- x# R. H! k3 e1 z' g -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
$ s9 n! n7 p- z( J; [ 6 U9 ]7 E* w S+ E
不停的ping地方主机,直到你按下Control-C。 [7 v5 R5 j( g
1 g9 J: |: }, h/ j, R3 I) N; q7 v6 v 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & A, u% W% A7 i9 R8 E1 t# T
+ M F5 p: G& Y4 W
-a Resolve addresses to hostnames. ( \# s' j5 c6 t, n, y9 c( K: ~
& c7 j/ T+ u+ x; ]# a* H* Q 解析计算机NetBios名。 p9 q5 i5 p6 k$ \7 H
0 G6 P6 C, m9 |& n: F4 o 示例:C:\>ping -a 192.168.1.21 1 s/ E/ P, u0 g. c+ y O# Z7 a N5 L
% q6 c* j; y' y$ O Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. M4 K) H# {0 s4 A" a
# m, P: _6 E; G) c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; l5 o- v5 K* V4 ?
* w3 |% u' }9 a% \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # h0 j) H0 q5 D/ \$ w
4 L, [. q1 `* |3 [8 Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 _/ I9 W( f3 m) u8 F5 z
4 W! O7 I0 o% N ?+ L x# E
! ]/ Y2 E- k2 V# P. y. q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 I8 _, l6 Z& X9 Q' {
7 ~- L' @0 a: }3 {1 _& f2 E# I# q Ping statistics for 192.168.1.21:
V& e* I. Q @' ?6 Q2 B; k ~ / @0 V$ \* q- m
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 0 s" L% n/ x8 }+ Y. w
0 N; w5 d% L' e+ w N
Minimum = 0ms, Maximum = 0ms, Average = 0ms
. K' k! J1 u/ S5 r* s7 N
) i; `% B; N9 v6 Y7 F( q 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
9 B% c4 A, @- _* f1 T( J8 D " C0 f- ^3 J. z4 @/ H+ b
-n count Number of echo requests to send.
. R' `- X( s! q' s5 `' b1 P- _
& n. F/ K O' u* V3 R8 F/ ~8 ~8 M& L 发送count指定的Echo数据包数。 - S- |* \) r$ v" ]
5 q, C# z. O: C$ S ~3 Y9 G9 l 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 1 n6 C6 L4 ^( s, W# E' w0 z
# K9 v; M/ y. Z1 `' T) a; n
C:\>ping -n 50 202.103.96.68 H+ C- ^/ E. O0 W" v, ?, J
& L3 J/ G. _/ m# l/ Y, t% p. X K$ [
Pinging 202.103.96.68 with 32 bytes of data:
9 A2 r# t5 F8 \* d/ G C" c' s 9 V+ T+ ` M/ Z- ~0 y r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " M8 _, ]0 y4 O/ \" G
2 p7 Q, S, o+ ]+ N: L; U. q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. f! S$ Y! ~1 ~* Y
# B" A' b0 I- \4 @! O2 j7 H Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + T& A f. S; L4 n4 v# X
; J6 M! s7 ?/ a5 O) P- h
Request timed out.
7 @) s7 h Y2 O- w
5 B) g( Z- s4 f ……………… 2 e% V6 M1 f5 Z* Q$ z: _
' e+ }# G( w9 W+ k6 u Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% d0 w/ A' g. ~. F4 u8 E$ p2 G : T3 s8 ]3 H+ @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 C. S( e5 i1 l9 b: f
; G# V; M* \8 P2 D2 N8 L2 x Ping statistics for 202.103.96.68: # n: F7 Y9 h* n8 N- G
8 s& Z" \! G, {' O1 v- E
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
; Z# p: J% g2 u 7 X0 A5 s' W8 n( G8 l
Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ g1 j$ _2 s J% a; P" I! v
+ G& P* o$ T9 |3 V 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 # w* V* O5 v |7 q
' e( N# _# s$ L0 Q5 `; w7 s. b5 H
-l size Send buffer size.
; c" ^/ g: T7 G( `% U4 Z# t) l( N 7 ?+ B; a( [" g, m- i4 u
定义echo数据包大小。 |
|