标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
0 W9 ^- Q$ _) Y2 @; l6 I. f1 u/ O
* ^) x# y! I5 m. U$ h3 `8 h
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
C% I+ y1 Z" k' j7 s5 Q9 Q4 z0 r4 G0 F
7 w* F+ R. t+ S% U) B6 N
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
' U2 ]$ {$ D9 n6 X4 f( s
' _5 c& H! ~# k4 R8 `
Options:
. _: D/ }( b/ O% M" k
, i w( v# U, |
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) n8 E* g( Y5 U8 L& r
" U& O0 z5 ? C" g( b
不停的ping地方主机,直到你按下Control-C。
1 o; J9 a( v s& H
* X. Q' w. j6 n; d5 u% R& D
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
' O5 U Q2 S) y4 Y9 E! O
% i5 u0 i2 |; w- [( ~* h' S- M
-a Resolve addresses to hostnames.
) f& r7 M* C j1 Z* Y5 R- I
% v6 d# C( Z2 O" m0 J
解析计算机NetBios名。
& E; E( n! @ t) q u
( d/ y+ X* l& e+ ^+ D0 M
示例:C:\>ping -a 192.168.1.21
+ }2 n$ f) Q+ }+ f, Y
0 d( B3 Y! J& M' O& L" A4 Z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 {; G2 e- @2 V, w3 d' S; e
5 G. V0 F$ A) C1 V3 L l
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 R7 s! U" q n) P! ~9 j1 b m |
r r, M/ W6 a" f* H4 K; @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ [( {3 m7 k3 `; I7 P
. u+ u( ?' c7 v& m9 }$ s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 ^. E- w( u) D$ z/ U9 L) O) i- G
i9 s: B7 V4 F$ F1 a1 }. t
& ~5 z& L# ]- w4 r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 O e/ v2 J1 s1 y# c
8 }( o8 U& [# W( p
Ping statistics for 192.168.1.21:
2 a5 ]3 y/ Z/ s' j7 q- b
) G9 {0 n) ?/ r6 i N% l
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
( G' W) w" h: ~
6 O* n" f! K' r+ U3 l
Minimum = 0ms, Maximum = 0ms, Average = 0ms
! [' w4 T/ V% H" L- U
+ `8 y! a) O0 q* l9 X9 C' g
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
* {. Y6 O9 Q7 l# l
( e0 I! x. F8 a. _
-n count Number of echo requests to send.
% W9 G6 p8 r. R
: {2 c: g) R& ]3 n
发送count指定的Echo数据包数。
5 U0 i9 B% b; c8 [, O2 z8 R
/ h5 C% U/ i' N) \1 O! T* x
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
, R% E/ G6 e3 k* H2 E- b. k% u* C
9 S1 j% r0 |- X7 r+ ?/ }& U! r1 x
C:\>ping -n 50 202.103.96.68
; s5 J" u0 f2 b- k* r( ^7 n: Z
9 m# @2 y; }& R
Pinging 202.103.96.68 with 32 bytes of data:
5 w# k3 v* t1 ^% U
7 P7 L7 T% {% h9 d; y- A+ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 _& v- d) J4 e
1 c9 M; f+ P! M* f9 A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% \# Z8 b. i6 s
! Z6 V2 u$ s. e/ U3 A6 O
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 r- w3 _/ z" X5 [2 @8 _- @
4 I! {8 }2 `) \
Request timed out.
# f5 k T) {' v% h& _: E7 u
9 N, Y9 Z0 k% e& F
………………
' e; V" X2 L7 B
' h9 E4 D" y+ N0 z, o
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. t+ Q( ?+ i% v1 ]2 }
/ E v- F+ k1 h& q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 A; g' e* A9 i) S* d2 h- ]
) X+ {5 y K+ u3 C# Z
Ping statistics for 202.103.96.68:
2 @. M" N. x9 K% B( h4 [
2 L# j$ {8 A$ a/ `5 c
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. y, _9 i p- w8 X! ~
- Q8 b3 f8 g A- q/ k* t" m7 N
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 H& G _# Y, m' h& X0 C0 x+ C" R
; {+ D4 k) Y0 g7 I2 T3 O* b
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 j; G& M$ H, E5 x b
* K" I5 A# ~; W6 l6 n
-l size Send buffer size.
7 Y% J0 b$ i |1 h1 w" T
8 o6 [6 D7 r: I9 |% t! y* `
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2