|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ; x* _. W9 a7 \7 z
' B* G T0 c( u 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ) t) j) j$ T8 D! P: n
" }" H4 |/ T3 b" W2 @
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 ; h2 a9 h. a/ j s; }% u
4 w0 w1 ?" h' S% d6 K7 P. i Options: `2 P+ A; Z$ \8 |' d( F7 g7 N
! a) ~: Y: x- p1 ] -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
" B" i$ R, }7 _" K+ M8 j) \" f* G% u 7 Q, Q# j& j5 L
不停的ping地方主机,直到你按下Control-C。 # u" q; j+ w3 D1 J8 i
# q4 P7 m. c* j
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
0 N" a, u; M" B; e- ~& [6 X& @
L F; }; C: l- ]# ^) d5 y. G3 z -a Resolve addresses to hostnames. / B+ P! ^! E+ N& e$ Y
. C% M* d# H" _( A 解析计算机NetBios名。
' W9 k( {$ I1 a. d 5 v. m0 H/ h2 l' i+ F! s) L) ~
示例:C:\>ping -a 192.168.1.21 8 i# m# U% s* ^& N
. h. {" N" r7 p, E3 O$ j Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: : t) J: E. K9 e/ d$ G J- R4 |
0 y i/ | j4 p/ D3 K% J% z1 [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 }* X6 b; k" {" u, A + l1 A/ z, f: Z" M& v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
- k) o% d* i$ W+ L2 w ) j8 j. |2 G4 B' V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 s+ H+ x y9 c+ N4 s9 \
( M; d8 [; N; ]# v3 F3 r
& \( D" L/ f# F* P
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - D5 |; V" {" x4 Y/ y
- v4 z+ b8 N; y, T! g0 g+ C Ping statistics for 192.168.1.21:
" k" H" m+ X0 @" u7 W2 y6 f
; n9 ~- v+ N" h' X3 M+ @8 A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ a' W* j; _9 C$ B; A; X- X1 g/ x & F4 }. o+ K9 v& D6 u/ S
Minimum = 0ms, Maximum = 0ms, Average = 0ms ! Z+ V0 U7 H- P# j# L# Q
7 \% I t. y, e
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
5 S! p! x$ p* B1 U! T2 k/ L* y
+ n5 N1 M7 t' k8 F -n count Number of echo requests to send. 0 f* ^" H! T q0 y$ _: M
0 N+ v1 f: W; m" a- S# s' i& i' _
发送count指定的Echo数据包数。 : n1 v, i( O( M. _- ^( E' h8 `
' O P0 [2 ^! C7 Y
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- ~1 ~1 J' I$ c; r: C1 Y ! X0 R* l; t- } J+ m5 i% h
C:\>ping -n 50 202.103.96.68 6 {0 U: s* t8 ^
! ?! B- ?( E$ a9 m& T* J/ h Pinging 202.103.96.68 with 32 bytes of data: 9 n! j, ]8 _& k
+ Y% F+ m6 x. V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& w. y8 _+ \7 D7 j' L2 p 7 c2 W9 V I1 u
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% c2 O1 X* B* {% v1 S, N& k ! N. c5 o3 [. X) `- X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - u8 P. e+ }+ Y0 h; o
' V6 h: o2 V" F( T# k5 V6 A* G
Request timed out. ' t( l J7 ?- B* `2 T- q7 s
0 E2 Z6 i2 N% u' k0 o9 P1 @
……………… ' e G9 s9 O1 H" h9 S# P' k ^
$ P' |9 f. F7 o2 a1 k* [7 c# s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - W$ V0 y8 A7 s! V) A) o
$ r4 W' @9 O3 a! M( o' ?. w* w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - _0 i% x+ P, c9 p) K0 E
! Z- E2 J/ W' ]$ ~0 k
Ping statistics for 202.103.96.68:
- }3 \+ x! C1 i' Q" v4 R
2 m. F6 r8 M* K% G6 Z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
/ w% v2 r! P L; F
1 t% C1 ]0 t5 N Minimum = 40ms, Maximum = 51ms, Average = 46ms
) G4 I7 w! _+ C/ B8 E! _& S" ~. R
; i! L. y5 k( w/ D, o 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 w# b5 |& _% A9 `: a
, Q; T6 H7 | Y- z# V -l size Send buffer size. * P: _3 {! Z5 W) C
/ j9 A4 P9 V/ I: ~
定义echo数据包大小。 |
|