|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 7 t2 C" `% ? [4 A N) v# E/ M
d' T2 R* y1 N) @/ Z* A% P6 Q 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 o) `6 M$ w. e I" Y# P + o. t6 ^+ O) K$ |. K
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
2 R4 k& W1 F5 O: `, [. t) X ! O$ E& `" T1 ]' l7 E6 b6 o- v ~
Options:
5 V. K# n0 P% F# `8 m 4 q1 r+ D1 _. O6 p* G
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 g4 w A2 @/ U9 ]" s
3 R0 A+ T- u G o 不停的ping地方主机,直到你按下Control-C。 5 A0 y, j: C' t' g- O
: D; v3 g- l3 ^* C1 O' M3 a' b 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
0 c; U) n0 r, z4 p9 e% I2 W / X8 {; v. ]# E* g. F
-a Resolve addresses to hostnames.
' J) d: q0 |8 I5 M. v7 k O3 t - B n3 c r" a' w
解析计算机NetBios名。 : A0 z9 i9 x2 `- Z6 L6 h4 L
. T' w, D& R& G( {/ A/ k 示例:C:\>ping -a 192.168.1.21
! ^0 S& p/ {5 y. [5 e* A 4 @& q/ u) L3 P, d1 \
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
1 o. E; m, v+ ?/ d' w' [ ' R: t: B0 P, Z# t% r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ n W& V A4 d" o9 [
8 m5 N9 E0 I: B Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" c! [" B( e* c) b+ \- \ / C) g9 ]+ s' s* U
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( n& f6 b( B& k
$ r4 W5 O5 k8 U3 p8 q& y! N
, s6 e6 o3 H B, N9 a+ D8 A Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" c* w2 l+ v: E
- j+ _/ f( ?1 R+ m( q Ping statistics for 192.168.1.21:
% T: E2 a/ Z5 l# Z3 ~ % n/ o! k8 I- w) s* H# `% E% Z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
% _+ Y) n0 o' ?7 k2 v7 f+ W0 d
) i! K- r( g. I+ _/ } Minimum = 0ms, Maximum = 0ms, Average = 0ms
* R0 E$ S* [* A9 P3 J5 g! K/ d8 T+ L
9 B% h5 n7 o: H7 r 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 C% C1 O( }5 k& }+ \# }6 d
* J1 N$ P/ f r -n count Number of echo requests to send. ; x8 ^4 M' j2 ?) U
) E+ O( B7 @( J- V I 发送count指定的Echo数据包数。
/ }5 R% _9 e4 K / I4 w: Z6 v; U X
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
! @% A. x% o5 E2 R7 A; f3 J5 B
5 G, M$ J, F, g! b( O. ?- y C:\>ping -n 50 202.103.96.68 " M$ h& E+ k" V) w4 n5 p0 c/ @2 H
, z4 [- c0 r5 q/ {8 ` Pinging 202.103.96.68 with 32 bytes of data:
# Z- ~- x1 `6 t$ i- P + @/ X' _# z; a, {* S6 a2 _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) [2 W' h5 i, K! Q) w, t5 R+ v
. V7 h! y7 L! q4 K7 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 G% }2 x4 _9 m) M' v- H 6 L0 a: U3 d, W3 x3 J+ Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / S$ `0 J0 d# _# H- U( U0 _
* i- `$ a6 D0 \/ Q* X# |1 F; D
Request timed out.
* r( W1 W/ F6 T+ a8 C" y8 _0 M
$ J! |1 Z$ _7 I; X7 l ……………… ; p: Q& X7 R# w# @! i
6 C1 U0 V! o8 q3 w% O+ v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ e9 F4 t/ o& w( u
/ ?6 K( C9 l$ R2 u8 X; R1 _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / h/ {/ P `! X e
9 h/ i! n6 W8 e! f4 R Ping statistics for 202.103.96.68: 4 Y/ B# h. ^, q" m7 v, W3 A
: J* w e; B! `" n; o* g0 } Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: % z' I3 A6 J1 J3 {. ]
8 w: d6 p: m2 ]# X* U; q" f Minimum = 40ms, Maximum = 51ms, Average = 46ms # I* Z5 k; @: H( O( h* r$ K
9 d, A) Y& Y, O- E* f) d 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 # C S( N$ }7 t- p: q, ~
- G) a0 A& E9 q; z
-l size Send buffer size. ! h0 r( w( K* I# z, Z' W
( d' j- J9 P" B# y 定义echo数据包大小。 |
|