|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ m6 p4 [" ` h* b& ?. R
$ }' D3 L5 }. x/ L4 q! I 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 S4 Y: `' T! a8 K; h/ n
* x6 \8 F' n: n# m 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) u0 o. D$ u4 [1 R. ] c0 b
$ W+ A; D# n# x+ c Options:
) h( q( C$ X% Y" ?/ G% D6 S
) F# L; E' l) }9 L# S2 D' c" o0 X -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% W5 ]' R3 M5 p" L- H' q# D 8 y$ e5 Y% E. p- p/ x, F
不停的ping地方主机,直到你按下Control-C。 - S! y @" g5 E1 U1 w
/ Z5 c0 g, J& U' S% d
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . m# Q$ s- Y% t$ @! h
1 _5 M) F9 ]( ]
-a Resolve addresses to hostnames. 8 G, o+ t6 \3 e. E( G
6 b- t" A9 S5 R6 e! E5 u H 解析计算机NetBios名。 4 z' j3 w/ B8 }! `' y% h7 N5 O
' U0 B7 u9 b6 T/ T+ x5 B 示例:C:\>ping -a 192.168.1.21
4 m0 i, q1 N0 R1 o! K+ ~ 0 ?! ~% V6 b- b/ Y, b
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
1 u7 b v2 ]7 Z7 j
/ H8 d' _2 `! }8 e- A Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) Q9 U# ~' G& Z; k; p) L5 v! k
7 S# Z3 N7 b3 r9 v; ^ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) Y& n8 X: E; j* p' A
) ?" @' H( e4 j- E" ^' p6 Y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 D2 Z- O3 i8 W- V' ]! P0 Z8 d. N
) M+ `7 c: J) [2 g 5 A+ ~* @8 @7 T T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 l5 i' F% u/ N: Z7 p
- ]/ V8 x6 i+ L Ping statistics for 192.168.1.21: # X9 s4 e( B! }5 S' c4 k! M' f
3 p8 E: }8 Y$ b8 P" v4 X+ H- W5 t
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: : o2 {9 ^) i! g/ N( Y, r, B: Q
; d: A F9 o+ ~4 h* z L
Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 V+ T* j7 m" G4 [
" s4 t; |0 L1 ?+ Z
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 h9 d, M9 R$ }& v2 ~! }( E/ u' h
0 J. N; a6 G- T: e! M% e7 g/ a6 i
-n count Number of echo requests to send. ' r% x, b t; s! m) R
0 {5 b9 C: F- N4 [0 n; V# E3 h- H
发送count指定的Echo数据包数。
, C; a! g/ Y9 D u9 J/ k# \& W# j - y @" E5 d% O
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; b5 S: D, T( ~' ^% ?3 Y6 p h
1 o* g- j: ~5 U7 P; \+ {- { C:\>ping -n 50 202.103.96.68 6 ^" t: W* j- \
: `; y9 D' Q- e
Pinging 202.103.96.68 with 32 bytes of data: 1 G$ D: A" W9 f& p6 r2 Q5 @2 }" T
7 q3 C, a: R+ }1 }' e Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 ~( T) x$ H2 \# e# M/ J3 G. J: z% ?
7 d% H4 l; u, k/ p% T- O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 _4 ^8 y$ f8 Q' ?$ e! Z& P
& m0 ?% p S1 I- V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 O4 @; C4 x1 G. C/ q
* H/ S4 E+ q) G4 |6 K9 C$ Z Request timed out. ( E1 x- _4 D- R( g
( S# S* [9 R% L0 C( Q3 `6 V
……………… 1 G( b8 \5 y& O4 [2 N) J
$ R5 R0 D3 ~. }) V; D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - M4 f6 [ e* {) M* x' ?
. n% g; t& |0 d9 ]. k. d2 @8 q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * }8 r" o7 c& z' H
* T! G/ R" Q% \# V" q- [ ~+ d
Ping statistics for 202.103.96.68:
; d6 V1 ]3 }. Z/ ^9 _8 k 0 Z$ ?/ c3 v9 e Y, f9 l
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: % ^" j4 g) L" ?) F/ Z" t
, S' p3 X& ]2 v! X; |5 J% L1 c
Minimum = 40ms, Maximum = 51ms, Average = 46ms
: _# i1 L8 O8 i , P% O! g* _2 a
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
( A8 e C( S5 t+ b v: Q' q
* Q. }# w& U8 ^" y- S3 v5 h$ ^8 [ -l size Send buffer size. 8 C) s, n8 x6 Q U& d( |6 Q
5 z7 l* u* w$ x- z. j s0 q 定义echo数据包大小。 |
|