|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
! K' X z. D& W1 G1 J. Z- [ 6 E6 x: I7 r0 ~
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: . U4 m& M: B1 F! ^: Z8 w
. m7 ?% v! v9 n# V) f1 W
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
& l! D" p9 w/ u$ a
: l+ L- `0 K2 i4 f0 t Options: * s8 f: i: D9 M3 x
A8 ^& [% D8 [3 n -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
0 v" ]' |% O& k
) r+ \. G2 p' [! [- G) ]; z 不停的ping地方主机,直到你按下Control-C。
$ z: C; x+ y2 r5 K' |- ~* Z . B& |0 [$ c; A0 a3 e
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
8 y0 R E2 ]! T7 W! ]
. P& J( ]. G8 e, D. b4 r* o -a Resolve addresses to hostnames. , Z' R* C0 A& w0 Q# _
7 x1 f6 F8 c+ l- o8 E# V" w( ^$ M
解析计算机NetBios名。 ! k( w5 R% `: l( L: {- ]) L
$ H9 T$ M6 Y! n" P( S h2 p 示例:C:\>ping -a 192.168.1.21 3 P7 C6 _' ?, ]6 L3 J- O
3 A& t2 V c2 m8 O8 ~ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: : G$ d% i2 d. E0 I0 P
* A" J( H$ i7 ^8 r, [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ v" b& b1 C; _7 S$ e3 L ' v) u5 c5 K! W; l' @) ^) U* S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & a3 f$ J# }5 I; s3 H
5 Q7 I) a3 d. m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 g: D" Q( H. m5 o/ q
5 S9 ?8 M3 l* a0 m7 {" U
4 N* |0 i1 r6 b1 v9 \8 s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 M$ s1 _8 _' o5 |
$ m. k, t5 F( y* i2 Q/ a
Ping statistics for 192.168.1.21: ! r3 W' u& _4 k& y: J: ~8 N
! r$ }# i8 X( _* ?* \ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 p7 p+ r d" B: S6 f G# t
) i2 x, L( u9 _: K" j) }# z+ Y/ U
Minimum = 0ms, Maximum = 0ms, Average = 0ms % m3 d( ?$ R) Z, q! Y; ~
5 `/ k& Q% R7 {& W: W6 U
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ n, r2 Z2 M. ~+ t % K. ^. t$ B7 p
-n count Number of echo requests to send. I# `2 B/ Z4 @# E
5 G! ^& I. W3 N: z& c/ z) {' B
发送count指定的Echo数据包数。
- h) I% Z" t7 | y7 u3 i& ] 8 F3 _% m+ i8 t) s8 a5 W- U
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( l) w) K) R' e% H" s* U, I
9 p& R0 ^* s- M, m F) O
C:\>ping -n 50 202.103.96.68 2 P" Z. v8 A! e4 F0 P
2 m2 F% o& }9 U6 F7 l+ ~
Pinging 202.103.96.68 with 32 bytes of data: , [3 e6 s, g1 }! K1 [: a5 A; I# d
0 O o0 W) ]) R9 D( k8 {, A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - }: q# _! ^8 z; }6 G
5 O8 j4 d* p8 w L5 d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * r. e3 K6 \ s! h0 d
" d6 ^: S6 X5 C& P$ M/ H
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # s5 Y9 m4 B1 M2 u1 B
; a7 N3 w7 i9 [9 x: s: M. `* o
Request timed out. 6 U5 \& b8 z Y3 f) z6 O
7 W' e' P7 l* _1 T: t
……………… 7 T% s( I8 L( x' _# W
9 |1 M; W- r1 R$ r) H. e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , z( c" O+ o& t" Y4 M4 y
8 g5 }: D% k( J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 H/ p& ^/ D [( X9 F$ @6 g8 X: N
3 T8 L0 H: Q# B Ping statistics for 202.103.96.68:
( Q9 L! G& v" k7 B 0 a0 |$ q. E: L2 _; U; j( o
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
' L) P+ d% Z2 N! G3 R! L
# s1 L# x7 M+ q. I! ]) U Minimum = 40ms, Maximum = 51ms, Average = 46ms
6 X* d" ?( N d" w/ e9 u' n
; \" O/ N" N' Q9 H* [) O) o6 q1 a 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ m4 l. x1 e, R$ ` ( X7 u* S0 ]; \* l+ v1 m
-l size Send buffer size. 0 M% y0 L: S1 S% |+ ^" K
' |( w7 j2 m( O, S7 g
定义echo数据包大小。 |
|