|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 & V# {1 H. Y0 Z2 K6 d
7 T+ H1 b4 h/ _ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: $ {) W# Z5 }. j
& B+ W9 K j: k6 @2 e, [' z 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
, D+ ]3 `6 [. K$ j6 x7 c" f * C ]9 W2 b7 I! ]
Options:
' l6 A2 n- i& p5 {
7 l! n, w' Z5 z, c5 j% x. N -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. " o5 J3 S, i0 d
; j9 Y5 J' N& \1 t, y 不停的ping地方主机,直到你按下Control-C。 " ?9 f# x( q* J0 b$ N" W8 O
, J* O7 R; b5 s* x' h0 t6 z+ p+ u
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
n1 ]) g8 ]4 S9 _0 Q4 V9 e 3 F" a5 o/ V1 l
-a Resolve addresses to hostnames.
# y9 i) ]$ u* a! g9 J
* n2 p1 q7 w4 p: d; ` 解析计算机NetBios名。
! h1 d, H# L, z) l & e6 Z' U0 s! l9 I, Y; F
示例:C:\>ping -a 192.168.1.21 & ~4 g2 t5 l' w0 V) d0 B
1 O) F/ e! `* S7 i( t3 H) Y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
; G$ W2 H' p1 `1 }1 I " p/ @3 ~) _9 T j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; ^, j. \* G$ x( V' m7 k4 G 1 h. F" O8 b3 U% c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 |4 x5 R" V9 c- d5 j0 z6 \ - p9 i0 v+ R7 x! X3 d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 j |$ J- b8 [) V0 I- O& ^0 H2 ^% d! w5 l7 q
$ n1 b# n3 V" [9 K; k+ |6 W* X
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' h" W( W7 j3 J) |0 B0 y
7 ?5 y C. |6 T+ E Ping statistics for 192.168.1.21:
' h7 @1 w! [8 \1 p% ?- k
( a: m. H1 o t+ | Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: * w/ S5 G4 B2 b/ v# K
! o, r$ _+ t, x Minimum = 0ms, Maximum = 0ms, Average = 0ms
2 ?1 M2 h, R6 v9 N2 S C
1 s" ^& i+ ?- o 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ( R5 H* j9 ]1 b# }. D" ~
: X7 c) z' X% H' N! I
-n count Number of echo requests to send.
4 q0 R1 H( p8 S" `4 d 4 z# A' S1 h( c3 d& y' i- g" x) A5 ~
发送count指定的Echo数据包数。
# I Z" j. J; P5 h/ }1 K : [+ O" A* a0 d( L- L
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: . @) g* O% h) b4 y& Y
* Y( q i1 E- ~, y7 a% j
C:\>ping -n 50 202.103.96.68
% W+ v/ p$ P' M # [; q& p# l. [: e* Z8 C4 }% V- k9 z
Pinging 202.103.96.68 with 32 bytes of data: * {$ C* u: U- w3 a9 [- G
9 _" l; f6 b1 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 J Y, r; p8 U2 ]8 y+ I& ^ 7 X) i. X1 U- M' z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 R0 P+ _5 ]% Y7 U7 K0 H
7 \) p' |/ A/ r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; v& @2 J" K9 {8 L+ S / e) I; A0 T8 s- c
Request timed out.
1 _* ?9 S, E: [+ ~1 x" s " ~2 c6 v' l) N2 B4 L
……………… g6 Y9 {4 O+ N$ u0 D# l
2 {5 [$ r; G& h7 ?9 d/ f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) v; W, |- G/ u9 r5 K3 @- p 7 T8 ^6 ?: |7 m# b7 a. s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 s! |# k0 W" R: P
. k) A6 Y! x( A) f Ping statistics for 202.103.96.68:
3 }; J4 [- N7 `. x; N
1 h6 T5 b3 t0 l8 @: i2 h Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
; q0 [/ W! p+ e
& q0 v4 c. r6 s; q: v I Minimum = 40ms, Maximum = 51ms, Average = 46ms + f7 ]. M" M" Y
5 n; i4 D- f, B& ]! B 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
- o$ X, Z1 R9 H1 l; }3 a1 t6 P& F
7 {2 k" P# |2 x" h7 b, N" B -l size Send buffer size.
7 b( m6 L, t3 B9 q( w
; p2 K* m" b; W* m! h! Z5 M- w 定义echo数据包大小。 |
|