标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
% K9 S* d$ O" e$ n$ o, @
9 k! y- A6 x1 ~) L
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# I4 p4 v6 E) i- Y) w( r
. ?3 x, }- f9 P: P; L0 ]2 S
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
2 h& q* ?& s* m% K! X- Z
. j e X2 F' J, i7 `, E
Options:
9 @$ X" T& @: W. T( |( t% j
& @, _5 T& K6 ^( r4 G' i* p9 e
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 F) Y# u0 V- n4 S# z- ~& L7 d# C3 c% b @
% {# v0 H- B p0 X' b: o! z' n
不停的ping地方主机,直到你按下Control-C。
8 X r+ n: A- j$ @* h% h1 T
. ^9 P$ Q- N# b8 f. G/ k8 Y* ?
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
( S6 U, q2 K+ ?" ?* }3 H( m
+ H5 ?0 t/ C8 g( A9 O3 i$ n* p
-a Resolve addresses to hostnames.
1 z* b( q( }" O6 @+ p0 `
; p: o/ h" ]1 X! z5 u
解析计算机NetBios名。
; F4 {2 L& i- M! Q, c5 t
# Z! T! b' C) E2 O( t5 [
示例:C:\>ping -a 192.168.1.21
5 v; A- m1 t, ]4 _' ~8 K% k5 @8 }
' p- Y2 z; l; e+ Q
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
3 w& J# o3 ?: M8 v) q0 d- h
# f1 C" t# |7 k0 v. c) c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) o8 Z0 T. T$ M6 Q" D# G; K! S
" V7 {+ m" e# f) |% c: h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: @* K# R6 Q, _: Q8 B+ y
- Q+ p" p* V `# I! F) Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& \9 J; W- R- Y) U8 _
! E. g5 g# r( Y
1 F$ t) _8 U$ l3 t; E+ ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ E. u( r; o2 J% ^. R+ d
( i; g3 ]1 r* a1 v
Ping statistics for 192.168.1.21:
$ o2 {% n4 G9 }: i5 c1 I9 L) m3 r
0 t4 E* c* E% p6 P# X7 V1 A) `$ y
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ Z4 h% p6 R' `+ I8 V, E
* E/ \( _* W! p
Minimum = 0ms, Maximum = 0ms, Average = 0ms
) R5 X1 p: s& V5 C. s6 u
& J) F, N# n4 y% ^ h1 n/ V
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ @& v n: |& m
: x5 ~& O1 _* m2 I9 z. n
-n count Number of echo requests to send.
/ R4 u$ s# N# W c- U7 ?6 ]
2 [8 ?, e$ U' R: S3 D
发送count指定的Echo数据包数。
; x& }' j4 }* K
1 i8 q) n+ ^6 ~# M1 h# W$ Z) [7 U
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) Q) V/ K5 Z( Z
! k. Y9 S& t0 p' q* j! y/ Y
C:\>ping -n 50 202.103.96.68
2 w+ [4 M4 \/ l( v1 d. E
; r5 A) h$ ]" |6 b! d
Pinging 202.103.96.68 with 32 bytes of data:
" P, w& o f) t- e( v6 ?, ~5 _- l
6 }4 n4 B( l9 _$ Y0 b* l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 o E4 f" e* T6 D* _2 x) K8 y; {
* H$ I& }# }6 j# ^# ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 O: s) U) B9 h% ^1 g/ U+ w2 f, v2 _
: g" m; y6 m4 P$ K( ]' R' w! E0 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' i) V! ^. G* x3 N; ] }- W8 b7 v
. \2 ~9 E9 ^! s4 Z& C& h b% U2 V+ h
Request timed out.
! P* g" W7 g1 z4 B% p! L* F1 V
7 d A. k7 J# i/ B: W
………………
. o& x x. t P8 W6 b% ~( e
$ V& G0 }+ h; j! }, }* i( o( ^
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 ~3 F5 f9 n* r
- a1 q7 |# J6 Z9 G
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' ^% r) ~: I# ?% z8 @( e) ^! `6 ^# {
; `5 z0 k" v+ M- T
Ping statistics for 202.103.96.68:
: [: \2 c; w' H
$ {9 E4 ?' y* u$ u$ Z# d6 b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
9 Q( d/ W$ [1 w) L& x
8 ?% v& ~' x# j% j0 h5 w' Q
Minimum = 40ms, Maximum = 51ms, Average = 46ms
8 Z, h' }& v2 M) d* x, k# D
4 ^5 R4 S' {, w( x" O' _, q
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
4 Q1 p0 D2 N) S1 |
3 F: A. _" p7 E0 A$ d* [
-l size Send buffer size.
7 L2 n* r: S, R
$ X/ X) J# M- E' m/ a
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2