|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ i* h+ q+ g) k2 w; o- g6 w
0 @" \# y4 Z7 D+ F; L+ G( H 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 `* s7 e7 |2 R$ Y7 F, Q0 M# X
$ b2 E! r7 x" f7 T 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 % _" j+ E( M+ a# S5 p. T0 @
* L* e1 j5 O8 B9 T
Options: 7 i* N$ n2 M! l, T2 e
' P, x8 N W+ P | -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
B, p# K- o) C! p
3 ]% A' X( Y! x: v 不停的ping地方主机,直到你按下Control-C。 * J) B, J% Z, M' o% h$ t0 p+ c
; Y3 V5 L1 i5 @- o3 k: h
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 5 O; k' y1 t' J6 Y1 a+ g% ~
1 s% S8 a9 i, m. R% e1 m -a Resolve addresses to hostnames. ' r8 Z9 Q* y8 T
6 A J& A! U3 {
解析计算机NetBios名。 7 `3 q& ^3 ?6 v% S8 [
3 l( J" O3 e* {% J4 f7 u
示例:C:\>ping -a 192.168.1.21 0 Q* Z4 k$ i3 v$ W" z2 N6 x( L6 ~
8 W, g0 k/ w! B3 z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" A$ R" q6 i6 f- |, D, E7 i& J! \ ! C4 ~+ B0 o }
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 |* u$ i* Y$ L1 H) _; V; ^. I
+ i9 M9 \2 m4 M# B" L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 B" ^. g) K/ k1 a6 }9 J
" e3 L. N( `( h0 o8 D6 Z6 P0 f# R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' t5 \7 U. ]2 A( ^5 H6 x
2 J( K0 _# n* l4 W- T8 Q& V3 E
9 F: L( M _- W2 J Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 h0 [0 Z' r/ Y
4 O+ W$ R9 s; q" _" ]" r$ l Ping statistics for 192.168.1.21: 3 |- _1 q$ V! t1 J2 x
; F& n) Y. q M% R3 ^ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ! u2 [ U5 I% a8 J, Q
4 _( o) l/ X. n f* H' A) \ Minimum = 0ms, Maximum = 0ms, Average = 0ms # D6 ~! l9 p3 a5 R7 c* h3 H2 k
; U' X+ Q, S5 L 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 W; b: k) Q) W8 U6 w; V' |4 F8 ?
1 v* t9 {5 Y& A+ H2 s9 P -n count Number of echo requests to send.
( X( @' Z. b2 g. ^+ M4 r% `( L
8 t+ M' e" O2 d9 [; N 发送count指定的Echo数据包数。
) {) c& U: |; I* M* A , S0 B8 t1 R3 n$ s! s" k2 E
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ; A: `% ~9 \" \7 L9 `
8 d( J4 A2 z: I; B C:\>ping -n 50 202.103.96.68 $ Q5 l) d0 [% n; L# K
' N) h, u, K. ^4 S1 w5 ] Pinging 202.103.96.68 with 32 bytes of data:
0 B% m8 Z2 N$ H3 P i5 m8 M5 B& }9 k; C+ {9 A( h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 _' r$ k+ X- a$ s* ]* K5 W
" ]2 [: |1 x6 d5 M( w0 q7 Z! [0 o Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / p/ F, \ R9 e. E1 _; ?# S4 b+ T" \
" k+ b: m* T$ u& j4 ~- N7 I* X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 u4 Y9 m( `, c1 `$ U, W- r
/ m: {9 e+ J, n9 [" M R R* S( ?
Request timed out. 5 I# Q- G$ S+ y/ _$ q
2 | H$ {( }% N5 u$ m ………………
6 c1 ~* H/ g. F 5 j( G# C- w- p2 z; M- Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( ~8 G( b/ N3 {% t6 S$ E
[. m+ E$ k: e+ y0 F3 s9 m1 r; a Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 S- O- k6 n& Z9 f
7 K4 K+ p+ g( q) c+ X
Ping statistics for 202.103.96.68: * o; I: z2 Z. b, R4 K
0 j/ A7 G5 j2 Z, `3 x- P
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 j$ F5 z! o) j& s # M. p, _4 _$ F5 N* x O& b
Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 W5 J4 x" N# J/ r' |1 o& T' } : H9 r0 I7 o: x, B6 t+ u/ M1 x0 {
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 3 s7 K, Z2 P; P
* L$ W2 q0 `5 y# ]
-l size Send buffer size.
* D4 {1 M8 ^0 G o; l. P1 ] 7 }! ?. R3 E/ A- }
定义echo数据包大小。 |
|