标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ L2 u8 X) L3 Q0 G/ R
0 J& H4 [$ M6 {! P, [; G
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
1 @' O: @5 x& l
( W# j- E, r" L- V- `7 U$ h5 o
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
( Y% ?. k" N5 p. g: V) d
2 \( `5 r/ V* r4 Z2 I9 S' a, ]- S4 C6 e$ ~
Options:
4 S' T# U, ?5 W+ w
; j. L% O: j4 F. E \
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
+ c! K% S6 j& f- s( [ K1 w# b+ x
, l# |# o( O5 S, n$ P) [
不停的ping地方主机,直到你按下Control-C。
/ c1 w/ j& H) N, |
* A& _3 f# @2 g6 S b
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
0 Y' I2 l; u/ G
; U: |2 H( ~9 y/ R! M1 h5 T4 }7 Q
-a Resolve addresses to hostnames.
- m" i$ \ W9 c% u2 ]& X/ t+ x$ X) m
2 g, g9 {. r5 T
解析计算机NetBios名。
, C2 g7 T( w3 i% c6 P! ], o; w
4 p* `+ v, N- a2 z* E$ T4 P
示例:C:\>ping -a 192.168.1.21
K7 e* @( [4 g2 o. Z& E/ E# t+ Y
0 `- A. c$ U3 y1 G
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. j8 {, }$ [/ L+ R' Q1 f9 q
, x8 ]4 @7 S: R1 K- ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& E- S7 J& ]' }0 c: V) M
& n0 H5 t) P" `3 T9 W1 B; j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& h2 _6 x: ] `+ S7 q2 s
5 s" _8 ? m" f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! ?3 R6 ?& { f3 J7 z
4 B" @0 Z% g9 }& E5 x/ Z' m
% f2 y7 c: M' Q: s& [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 M( { t2 C% q; A9 Q
! m( Y* ]* Z2 Z |4 C9 b6 B0 |
Ping statistics for 192.168.1.21:
; [" }5 ^. [; S$ H6 H- S
3 {( D0 K7 {0 _* b8 J# @
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 @, d8 Q- N& Z0 m, d0 j8 O
) M* ^ w: A$ {
Minimum = 0ms, Maximum = 0ms, Average = 0ms
. j+ e3 p3 @; A% O1 j+ n9 y( t
0 \6 R# }$ n# J( K8 x4 @* D
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 m; n. e5 Z3 P* k: x; h" M
5 }$ Y( E3 x7 h& C4 b" n. I: a
-n count Number of echo requests to send.
" {" k" G& Z+ J- G9 \
q8 ~" `/ p9 r. I" e1 P& K- {) z
发送count指定的Echo数据包数。
/ y1 H+ U0 h% U- j' O1 \2 y
& a- P. ~- M8 @( b
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% g1 z X& h% l9 N: U& `1 c
3 R$ Q' o- d. H# ^
C:\>ping -n 50 202.103.96.68
. {4 O8 m P. O# I3 t8 W
! P2 c0 D3 ?. m$ L
Pinging 202.103.96.68 with 32 bytes of data:
+ z9 Z! u0 s' X b% }4 i- ^! @# f
, ]# b* i1 [' z" T. p- Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& ]; C& o5 Y3 k, I; U+ R; R& Q
' n }$ K1 S9 f; x" K0 I. L
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 l1 J: H; E& b( F" R
/ B# z) X8 O* {
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, I; K- u, T I9 w
8 Q: p) w* X6 I; V& s
Request timed out.
. F: z: @3 V( C" v& p9 W
2 n+ `5 P5 j6 d7 j
………………
: W; K3 v; J4 V- A5 V
7 }$ l& I$ @) e1 A# L) q- A( q; E3 r
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: h7 f7 x: u. h3 o, F ?2 [
! F+ p1 X1 w) l( H9 Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ x2 _: I( q$ Q5 t1 |
# ^, v( V& v1 E
Ping statistics for 202.103.96.68:
( K6 |+ {# ?( @9 t+ P: G
, n0 A: b1 j" p' m2 S
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
9 U/ {1 }$ H; m4 v2 Q
9 n0 O0 B9 T% |9 T# C, b4 l0 Z3 I
Minimum = 40ms, Maximum = 51ms, Average = 46ms
" O# X; b9 V: V, M6 I
; G4 S) N& s2 @$ @
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
: P0 O( Z' |2 \4 a: D) q
8 V/ u8 `/ _. H2 Z- [
-l size Send buffer size.
2 ^% s5 f: d) }, T5 {, P
% T1 X! u* t4 g* e% p
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2