|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, ^: l6 t7 U& H2 S( @0 i: B- A
+ L$ f/ o& P' s1 h2 P9 N. B 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
2 [$ x S3 V; b8 C& g) U9 }6 c% _
7 A% G2 T% S$ x 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
3 X4 \: B: G0 p* N ; a- L5 [6 [; ]* g5 {
Options:
! d/ P, P8 _' y* O/ n* ~# }8 { 6 J8 b8 V8 p7 A- ?3 r/ |& S) B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 8 R' |+ D8 N8 x6 ]5 `. R
$ k, i( i' L% R0 k3 i$ h. a' B' o7 o 不停的ping地方主机,直到你按下Control-C。 & Q6 J; j- J- {4 `/ f6 l
- {9 D$ H' U, {9 D6 H& @ b0 f; Y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
: A8 V, ?# @# j/ s7 \
0 c6 f4 J! A' m! P* b -a Resolve addresses to hostnames.
2 R% E; Z& z, ]6 C$ e {- @8 c ) p$ _/ H: @! T, C
解析计算机NetBios名。
. S. \; G; D; |7 ]* U( h, X & Z! j N9 m6 S) Q2 ]8 H
示例:C:\>ping -a 192.168.1.21 p( x) I: o/ r
( y4 z$ f* B7 T* O& i7 L Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 9 k7 i: d8 N, I% X
% e4 H5 N, t- Y* e5 v% g9 w5 R e( I! c8 U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 s: N1 a& T/ }2 u
+ j" s! a1 c1 n4 W: e' d. ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 {* l* L! F0 l+ G9 B4 d1 d
4 o) k, f* A- N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 [8 @# C8 e6 `$ l" G! D' j& \) k
$ ]1 s8 y0 S6 Z
& M# U8 Q* ]& G6 u; T Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! w8 \6 s, b& m
5 _8 u' F6 E/ V/ T$ a) }7 P+ p, M Ping statistics for 192.168.1.21: 1 C, ^* L6 N8 g: v) T
. C) u& t4 N' A8 R8 t Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
& r v( b# N4 j' j
: U+ Y3 E3 v! L6 ]8 l Minimum = 0ms, Maximum = 0ms, Average = 0ms
$ ?4 h2 f* v9 P; L! J+ B
. ] o0 _$ l1 u( R' ] 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 % g5 r" H7 D' Z
& }2 A P. v% m; u) J8 h7 R+ N
-n count Number of echo requests to send.
- Y/ K1 e( X9 n1 N3 J
) d$ R) R3 b/ ?( l1 Q 发送count指定的Echo数据包数。 U+ n& p) }6 W" P* I6 H, ~1 V
" G! ^6 G' m" I7 H5 c4 ?. E
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( v$ f ^5 a9 L- [6 C2 Y, `
* e% \' P5 \' L% `* [8 s& o& n# x C:\>ping -n 50 202.103.96.68
2 _8 p/ |/ z( A2 `; Q1 m! c& I& o - G8 J8 l8 ~' O
Pinging 202.103.96.68 with 32 bytes of data: " H' B/ M- b% M% L# j7 m. Z
( W7 e0 V! e/ |( U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 z6 h: y* @" Q/ T9 y' l; m5 i; [
0 n+ n( |$ g9 z% c0 Z6 \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( g8 M1 P% I5 V ?; ?# _
. V# ^! \1 S/ y% d7 N; w3 m) \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 L- K9 W# f0 D
1 N7 w; G* H- z+ a; H( F Request timed out.
n4 `" w" f w0 |6 H
- T/ ~# P/ h1 W) L! x ………………
; A5 t+ q1 g0 |1 z/ G& k+ p ; S7 \) x! G1 ^) ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; y$ W7 D7 L2 V" C; ]% @0 b _ 9 D% @$ H' Q \" |% Q/ B$ J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ G2 u/ y. M/ B4 }) ~) U
$ Q3 ]) u2 D E0 B5 T* z% n% F Ping statistics for 202.103.96.68: 4 G" [9 R3 d+ Q; Y
; v( Z2 c( p" q Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
, @% Q2 Q2 v' e6 `: o 2 [7 r b5 b I% Y, ^( r
Minimum = 40ms, Maximum = 51ms, Average = 46ms 2 F: R G2 J9 z# H7 K/ x9 D/ v
8 g9 @3 Q, L1 {' T1 ^+ {5 q \ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; X5 j' h) \7 B) K4 b. |6 Z4 x
+ O; s+ u8 Y, @: y6 ?: u$ S
-l size Send buffer size. ( |% j }& e. T5 E
; `* M3 L1 j: ]0 r 定义echo数据包大小。 |
|