|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 o; V/ p3 _7 F3 {3 F4 N : Z3 s) f. j3 D9 C7 e& }$ v: y
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
% ] R- p$ ?# K# O
4 ~' X& @" r" Q$ T- g" z( P 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
) y+ u" ]5 G+ S - H b* d0 g5 N: G0 U; M- t
Options: ! J7 K# [' T* S4 m/ R& ]: e+ f( S2 l
( f8 K* O5 ~( S9 j0 {/ G -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 3 a) a+ d; ~6 j9 E
& r& @+ R' K/ Y1 R, O( {: y 不停的ping地方主机,直到你按下Control-C。
0 _" H* q/ ^: s0 }6 c
6 A$ v& @, F C3 d1 p3 x1 m 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
% a* M/ _" l, P* f" Y( ? 3 E3 q, u7 a3 ^6 k
-a Resolve addresses to hostnames. # ]6 [5 _; H# ]: J
3 s$ j% h$ v6 }; w( Z 解析计算机NetBios名。
! `7 C( e! w9 W( X- l+ o I+ M
+ r7 w3 s6 D0 t. K 示例:C:\>ping -a 192.168.1.21
+ P% P$ q) R7 K6 U* y# {$ a. k 1 D* G' Y. c7 p- R6 R; Y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , Z1 Z/ Q' F% ^9 T& [
& o) i+ r5 a2 g' a _) ^4 s& b
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 s" m2 k6 S2 H/ A+ D7 n7 X
' i; s) J) b3 `$ C0 {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 }& ?2 @5 k- {" _" f7 V
) G0 \, U9 @9 N6 Q2 s8 x3 ]; k. a Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' ~6 S( Q* h. `& f0 g: M& X& @: ^% Z
9 r& p/ R8 L3 B' Z0 \# E
; o2 \" p/ L# c- w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% W$ u8 K' P4 u6 q# A* b ( n% k1 M( Z6 \1 j- m$ r, w. S
Ping statistics for 192.168.1.21:
: s8 Z m( i2 N( H/ I+ k , N* j6 ?' N2 `) u4 y& E% M! S* E
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, F/ F' D( B1 @3 F ]9 q6 a " [: I; n2 ^4 n# L6 U- Q
Minimum = 0ms, Maximum = 0ms, Average = 0ms ' R: M* K2 v) M+ @" a7 d
$ t4 T0 ~# a# T- F8 \; f3 r/ q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
+ Q L n" I; B6 R* J r
2 U! C i# d! G7 D9 g. C -n count Number of echo requests to send. 2 b4 C# v: C" |/ w% ]
& a0 T) i Q1 d; k4 H3 N' E 发送count指定的Echo数据包数。 - W @: z4 T7 \: }
; I8 Y# c! T1 C5 _0 P6 z; i 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 G+ E! b' A( o$ m6 ?' T: [9 B2 s
. L4 r, @4 T3 P* ]/ k, w! u9 V C:\>ping -n 50 202.103.96.68
3 r1 ?* q0 w E( {( K + z( o; G2 c7 R* _0 |8 k# L; Y) H
Pinging 202.103.96.68 with 32 bytes of data:
' Y- S7 N' ]9 e) p2 o2 { . R" x1 A. W$ t0 Z. F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & _7 q- X7 y1 z0 Y( _7 _
4 ]3 P. S3 i8 N+ p) u* m
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 t1 [8 e+ Q: k; r3 f % o3 G5 {! t# n: R3 L- Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . k/ t+ l" I5 P5 W" e2 @
6 M+ d0 q5 |+ U; |4 y Request timed out.
0 C! C5 ~1 F+ L% h( v% f* z# x
) k8 i0 J. \% f; T2 n ………………
: s/ \# p) o' D; C# q, D# M0 y; t
: j. O' U* [6 V r; N Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# t1 r; d, u: X3 N$ H' J+ U 6 P4 ?1 Q: L6 x0 \$ N! R! U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* G1 q0 F9 r P: R- p2 i0 q _
8 L# b. R4 T3 V: ^7 Z1 i Ping statistics for 202.103.96.68:
: }* S4 j8 E3 [9 e ! U4 m& B. s9 v3 f
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
: Q7 U/ u9 }2 o" q0 Q$ Y3 s 5 Y' f" X- I' U& ]
Minimum = 40ms, Maximum = 51ms, Average = 46ms 5 S& ~4 b* K4 e' B% I+ R
' s8 v$ ]8 \2 r# S& K& s" E. A1 e
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 e9 G7 K) _2 O5 |% M+ l* P( W
2 h! p8 R$ I5 ?2 p8 R7 p4 k ^ -l size Send buffer size.
$ [' `5 }& K2 } p7 ~ 8 |, B. g7 b& j
定义echo数据包大小。 |
|