|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 6 ?" \5 @; ]2 R5 \( Y' @
- @# _9 x0 Y9 Y8 y% c$ U Q
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 7 B! n, v: K% L
1 c2 O( s" Q8 L
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 ( q# y/ c* n* z0 }) x' o
% x) ]% S6 `; U# S8 e. y' M. o Options:
; ^. g! o& q) Z- T5 p , r% j8 Q) L3 [' V" W
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 G1 M r8 |7 \% p$ M; i
1 R/ e% n; m$ T 不停的ping地方主机,直到你按下Control-C。 9 R2 E) v" S( h. J: g
1 ?) E; V: T5 N
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
# F4 x, ~1 t, t+ b ! J, V, }8 f- f' K4 P' M8 I d
-a Resolve addresses to hostnames. 1 a" T; K+ T& T% J
3 X6 W3 m& z8 ~+ O 解析计算机NetBios名。 - u* O! L+ q J. ?, y; |7 p
2 y6 O& w4 u: ^ 示例:C:\>ping -a 192.168.1.21
( j9 N: Y" m3 Y9 }7 `. a 5 }/ R- f5 i% m* n0 I) X
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 C2 f& B* w9 R+ E & h" Q( i6 _' f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 j, G7 |5 I# F+ O/ \
/ W2 F1 a$ s$ B9 ]. x/ ?( T! l" f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& r, Z( Y, P8 V6 j
) J. V9 B; K* C0 @8 \1 z Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 P8 m @, ?( i2 E P7 c
2 [* C# J- T' ?; d% T, H 5 N0 U$ L w s" ]0 n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ \5 ]* t/ b7 @1 C: M
( H* ^- ~ ~+ D3 } c0 W( I Ping statistics for 192.168.1.21:
- ] ~1 {! H$ E7 \ / K1 a6 }! k- _& V
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
" Y8 ]3 ^( v& M5 k$ O
6 ]& g# @9 o5 J3 ?) ^0 |3 f* L Minimum = 0ms, Maximum = 0ms, Average = 0ms
0 [$ g1 ^* N. b 2 n+ _0 L1 S2 ^- _* ?
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 8 e# L; B% K, Q2 A. F
6 N- ~# G* {7 C -n count Number of echo requests to send.
/ r6 F* V; ?1 C7 k _0 ?4 z
" t1 X e( X6 l* P2 h0 Q 发送count指定的Echo数据包数。
, W; j8 r4 f$ G6 s7 _8 X ! ?8 o. `+ \6 U6 L- H' N- p; _
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* G4 S3 u; G- r) C3 y, a' F5 \( M 8 B6 K0 p+ u- |6 O
C:\>ping -n 50 202.103.96.68 3 X. h9 G |- |
: w S P5 j# a) \3 q/ c) ~ b
Pinging 202.103.96.68 with 32 bytes of data:
$ N" L8 d/ U* \ E9 o 6 m$ P+ J9 d( j" F8 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 z8 H/ z$ w% k1 O; i# P( q
j' G* r7 x& o+ L' y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) F6 i: p( d f, U0 o2 u
3 n" _' X/ ^0 Z" U( P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . b6 W9 v/ Q7 d/ ^) Z W
9 |" }( V8 m# M; N$ E _
Request timed out.
! n {: x1 i: W0 U# n) O3 P. \ ; d7 K j% d8 s+ |
………………
' v! U4 X& y% c( c; ^+ j3 s2 Z 4 |: c( d$ }/ C3 b+ g! C5 j1 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 F6 |; a( w- j$ y1 W 7 }( V/ c2 F' a% w1 P4 q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 P, Q* O! x' A! l : r* w' ?% J3 J/ l! c& f$ H
Ping statistics for 202.103.96.68: : A* O' l3 D! R$ ~
. L Y- m2 Z4 o( {
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 Q! Q+ G% M* L6 w: N2 x
+ ~+ L) R4 g+ n. |
Minimum = 40ms, Maximum = 51ms, Average = 46ms
" }6 {4 S# Q- |4 G" O . K1 u/ V) U) k& T, J$ u6 g
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 M* u' w% a# Z/ F
* L ` o& o. T8 G4 D* Q -l size Send buffer size.
7 V5 c' n% T/ X* \* S; o. H/ z
& Z$ P8 y; Z- d' P' D' j 定义echo数据包大小。 |
|