|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
; `! F- B5 A3 j/ H' D4 I# R' R 1 s; o/ u6 t, U% L- n0 @
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 J% u! N2 F. m ]. F4 n
- W; s" N1 V" K4 N+ W/ i 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 1 L" B3 J. }* d5 f7 z
2 Y, e( N8 X8 l3 |6 [0 J3 m
Options: ( ^9 }! J5 j( I# M! T
/ d: r( P& @) m; M/ M -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. v" A* x! H' n! S1 u2 w" h! Z 0 B! Z% F6 b% Z' W, H
不停的ping地方主机,直到你按下Control-C。
, |0 t1 Q7 X+ X9 V0 @ # v5 O+ o. F; c5 J4 z! n
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 `9 I) ]" p* G8 P
# o" a# c! C! e3 ^3 G3 p1 r
-a Resolve addresses to hostnames.
9 d1 V% p+ ?6 z5 l) N0 C
$ i: ]& {8 e3 X+ D& b 解析计算机NetBios名。 " \0 Y4 q, c& `5 s6 N1 f
' |9 J0 k: A9 f1 T$ S3 O
示例:C:\>ping -a 192.168.1.21 6 B: h, B* K- q2 [* I$ f! Z+ R
; Z6 ]6 w) N' t) H+ J
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( O9 x: w7 a- c0 u
/ u' X* w7 P V: P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 h/ d" ]1 S* B* v) C; U
) i+ j0 L( m. `( ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " w4 q M0 D8 ]. W
3 D5 T! Q0 l) H$ [6 c/ e
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) s4 ?2 G+ O' y4 q5 y: T& }9 K
. u- U8 {9 @$ T6 s% S8 w
* U8 u9 f% {' X' ^+ `4 L; P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 q- W* A6 s# S8 i. Q- P2 M ' y3 o3 l" L2 \- z/ q4 v M
Ping statistics for 192.168.1.21:
7 E. M' E4 J6 E2 s
6 T" b" X$ k) g( Z# ]0 ~ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
7 E3 p, k6 u" k( B ; N) C3 }5 h+ X+ r2 k* u% n3 K
Minimum = 0ms, Maximum = 0ms, Average = 0ms / E2 v9 Q. }# l+ N! u8 K# d! @
* d* X1 k8 o$ t3 n" P7 o1 \% ~4 b! e 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + e. O0 U [ t* ]
' y2 d* K" r1 {- U6 L) N, o -n count Number of echo requests to send.
7 _0 _4 J6 d7 Y+ ] 1 k" [! G$ _% N" @1 j
发送count指定的Echo数据包数。
2 ^/ Z+ x" {, ]; j0 Q, X7 B
9 w O# _7 a& O9 c% C$ C 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) {$ w: w6 G6 |# ^: g1 z' h
: \% H6 ?+ O) r7 i) T4 A3 S C:\>ping -n 50 202.103.96.68 - U( J0 w% @5 Z
, V4 M0 C4 [# V1 G! c
Pinging 202.103.96.68 with 32 bytes of data:
/ h; I, p; H) s
. }9 p) U: h5 |5 }$ d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - w. W. m" G4 Q4 i
/ U w7 {2 m9 y$ H4 A+ }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / @* H5 B8 @3 c, _" x& T
. K0 Z8 N1 ^; Q9 C/ G) n# G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& v0 x6 p8 D d. q& W3 q- F 5 a. ~2 a- B8 M9 @8 _4 I: w" }( Z
Request timed out. + ~4 K' @3 z+ x& c% Q# o! U4 S
6 ?+ W- [4 C' W& M ……………… , q$ E6 _& o; m, l
8 I7 Y W. M: x: j- R/ D1 A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - X" J+ F9 s* {1 J
* r8 s1 U/ u9 N1 D+ ?# \$ |5 ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : B& l- ]/ M& V" A
r, _6 F4 t* M* J' P# _. z1 A
Ping statistics for 202.103.96.68: q# r; e6 [, Y8 B
" i/ [* n! a0 r0 F, e5 A Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: & \! d( U V' l1 X6 `; A
% x' L% M: j9 z- ~ G+ w7 c Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 L; m5 x. { S) o! X % ~! Q- c3 o0 X& p7 k" h
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 X# n" G/ j" y- M1 x9 G
% t% q. M& M" { -l size Send buffer size.
0 m; n% R: w- G1 B; d R4 v 6 G" o8 c6 F0 J0 d
定义echo数据包大小。 |
|