|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ Q0 G" k. m; G. o. A4 |7 I- x
- ?7 i. Q: Q% ?" v 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& h# n, g' M$ N9 i
! O" `' Z7 N% J8 R 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 ' {1 |2 v; K. T1 C3 P
* t- m; Y& w9 b. A" E Options: ! P: n0 A$ ^: t. A& }+ I: b" c
) q O0 U2 w+ _7 @/ ]& Q* A6 W -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 9 ^; [5 ?% @- Q% W7 [$ J8 a
7 K( ?: H9 r- q+ ? g' f( @- ~; t 不停的ping地方主机,直到你按下Control-C。
0 K& z. c6 G# H2 q% ~6 z 4 b( ^' V9 J+ J F! r
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 ~: z L: H' k- o* I
7 ^+ w$ Q0 {" }, V/ i7 @ -a Resolve addresses to hostnames.
: t* a W* n P/ f* C
; m1 \& a9 ?9 h 解析计算机NetBios名。
& V. d# |3 W) d
2 d! P6 y9 y( r) M/ ]/ c: F 示例:C:\>ping -a 192.168.1.21 ( l, W( R/ J1 l% Q& \1 I4 S
) z2 e* d0 x; I1 x- x) M Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: : }' q; \5 \% n; d& j& J
: @( `7 c1 p7 v& z l4 m3 C3 R+ \. A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 h/ K+ G2 S$ l
# _* F- S5 q. i' b
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 ?2 Q1 L% A/ `) ^
# U- m! J3 s" g# ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 ]1 ^$ i: p( O
! i4 h, m- |) g) W$ F/ X0 N 4 K" |+ f h+ o. S9 n2 ~/ Q
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( G( i0 o; F) b% l/ F0 z, j7 l. V( W
0 B/ B0 F7 `5 Q
Ping statistics for 192.168.1.21: * \1 N. L2 G- z1 c$ H2 T. `
7 H# C. n6 @+ t Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
5 A( ?- K; o2 Z W3 @1 y
$ ^0 e! h6 ?9 E7 b& h# Q# n Minimum = 0ms, Maximum = 0ms, Average = 0ms " L4 y$ C& U% p% k1 ^$ j) I( @* G% R
6 z) f7 }$ B& m" ^3 h0 }1 A& h3 \ 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
( \- H3 @2 `% M $ U7 U- W, ?9 G: W' G8 U) b9 x
-n count Number of echo requests to send. 7 J$ K. L: ?' L/ N
- y% d8 z: _$ Y 发送count指定的Echo数据包数。
6 K9 x9 e% j J) Y% R ) H. T# D3 G) M' V* U1 J
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
}: ?1 a# c' A' q+ ^/ ?
$ ]7 M$ ]9 L6 { N" V- {1 ^ C:\>ping -n 50 202.103.96.68 $ C# T" ]- t5 p3 P- M, T+ r
( c; c/ {3 f2 o6 m Pinging 202.103.96.68 with 32 bytes of data:
. `' A( m8 c4 T5 P: I- d# s
* t9 d6 l F1 u* c& v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , i0 K( {0 ^; b# ^1 I4 H
0 F8 n4 B) g5 Y5 p! x4 w3 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 Y! k+ @" n5 S+ M
2 f$ m& O- H( s0 J) p. e Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, E) ^0 F1 T, R1 W
+ U2 Z8 ^2 d, X Request timed out. ( J$ I. ` M2 ]% m2 l
4 v( d- T6 o0 E" d- K ………………
3 [' l7 n1 V6 \ B4 l5 }# u8 h& V 8 j, B1 X# z; `0 h$ R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' x+ n( K2 Y! o1 x 5 i4 F+ Y8 t a! P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * ~6 z, D, R$ M
3 L/ w; e7 Q; w9 j
Ping statistics for 202.103.96.68: 3 W' O- l' p! p0 I% Y
) U' O, H1 v; C# r
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
+ B( n7 x: c' L" H3 ?9 o, p1 J
\5 W7 W2 T+ |) ]) \, {" x, v. { Minimum = 40ms, Maximum = 51ms, Average = 46ms 6 a0 z! X- h3 k5 |( y' Z
' A$ B3 {$ g ~" `5 V1 |1 @ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
0 P$ t- }# c" Y) | $ H( [( D2 _8 B/ q9 w
-l size Send buffer size. $ m1 s6 H5 N0 `$ G/ j
4 f) ~# ^5 s; v( u 定义echo数据包大小。 |
|