标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 f; {- }. W* x: f; D
- s, X( i$ B I4 g; w
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
. W& l3 b6 W/ n- |% q7 U
% S5 E. h: b7 h s: Y
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
( u0 @7 \* n1 k0 H6 D+ c9 @
' ~: T" a3 l& U& j; |7 {
Options:
: v+ S) u- n0 |/ R( j; K
2 S# T5 T7 {3 y! {% ]) |7 [* J
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
0 L* A! d* Z8 q7 M+ k! k- X
* V; b3 v7 w; Z8 m6 v
不停的ping地方主机,直到你按下Control-C。
3 x& o# p T1 [* N
2 q% r+ g; W, X- X7 b
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
* p4 J T1 B' B+ c! G4 H9 m
* P' |7 o& j0 M; e8 h
-a Resolve addresses to hostnames.
9 _. l' n* d& o2 c( M5 N
# o$ ~3 K5 f- S3 E! h% F
解析计算机NetBios名。
' @# o) {% y8 j3 [. Y
6 J" y9 q$ n& X& }) N
示例:C:\>ping -a 192.168.1.21
. z% l4 U j- a# P1 g. c- N! f
# Z4 g! J% Y* {; O1 C, C
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
0 X* F S- ^& n- p' w$ ~
+ U$ R: ?" N8 o" V
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 X- |- o3 L o2 e
( {2 N0 P2 z- L& u
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% }, Y1 p1 [4 r# L/ \! o4 L5 B. z
. m& t! v' E$ }* D
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% x9 ^& n2 r% v7 Z4 s+ i
2 U& w4 Y4 A6 D5 ~1 Y6 }
) |& J2 Y: ]/ w. n& C' T
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 l+ T& k0 j: y( C2 a7 ]
1 T* T/ k) }- r% W) ~2 n8 f
Ping statistics for 192.168.1.21:
$ Z" f) R2 j8 F; T' _
$ ^' z2 F8 C$ y. K
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ W/ i9 L) g. H0 a
6 @1 ^! d( r8 d+ t
Minimum = 0ms, Maximum = 0ms, Average = 0ms
' Q$ Z1 q# m8 Q0 O* Q& Y
( r' s6 l+ `; a+ u! F6 S1 p
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 h5 F5 ^$ h0 r, p8 j
9 M7 \6 L3 z7 ^! U; v3 u8 K
-n count Number of echo requests to send.
1 M' L- ^) ]& H' c1 u: P" ^
2 t% H. y' p: {! C6 @ x0 r: I7 i* b
发送count指定的Echo数据包数。
* b7 ?" P6 {2 B9 H$ e- F; U' B
9 u# }/ X5 X" t2 P- B
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
; Z/ k# m" S7 d
- u- @4 p" J0 p2 y
C:\>ping -n 50 202.103.96.68
/ n0 y. ~( E7 W: x+ o4 P
) ?) t" |3 }2 [* n6 e
Pinging 202.103.96.68 with 32 bytes of data:
. e4 M- g! f2 i W
" d2 I: J8 [" g. |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 S5 ~% L! C' D ~: M0 j1 i$ q
3 q( o$ S" Z0 {
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. H: I1 k; z: P- `0 J$ Q+ H
4 L8 I; |4 U4 Q* F' X1 `. n9 C+ s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% w& i0 b& s/ J1 {$ {# o( h u
; r0 X: Y* S9 Z' x. x H' T. [6 ^( P
Request timed out.
X# b6 M" |2 ^# g7 D7 L$ }$ [) c
: ?5 U0 n7 m8 S3 V H. Z
………………
; [# {/ j. p' F3 L; y( v0 }: T9 J
1 I. c0 i6 Q* `& a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% L Q1 j1 V2 P- K$ @. R2 w
, A" \ P3 I! r& o: g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, L, l9 Z9 T$ }- C
( p# |7 ~! E% z+ ^+ Z8 n, X% C
Ping statistics for 202.103.96.68:
: E; }9 h" m. ~/ W8 h
- x, z* w" B; x) o1 {! K5 o7 `
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
5 O/ z: \! F) ^
/ e5 s# p: {' g5 t/ v
Minimum = 40ms, Maximum = 51ms, Average = 46ms
) t; ?. j. Y) y c; N& b
7 T+ t* \: _6 P1 b- t
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ o' w3 P: f& J5 F$ a
7 `5 U8 Z; k" l4 S/ g& ?
-l size Send buffer size.
$ E: Y/ _) M; B5 Q# c
3 d" k, \: O2 d7 ?0 A# y
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2