  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 : c2 w. \, x2 s+ _- F- g! @
$ W' x% a0 k4 T6 m: M 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 1 G1 V- n3 u1 U4 n( P$ G4 g
, Q' G K3 z. g& T. \
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
3 S- @$ @* e) J- h" Z # f( I' C: T$ g2 P2 h1 L
Options: * ]7 o' R2 V* ]) ] e1 y
% ^7 L1 e' E, |$ N -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ K/ C$ k& {) [. w& V) R3 m6 d
4 ]* u- N) y% l3 d/ O, ], k4 ]+ S: N 不停的ping地方主机,直到你按下Control-C。 6 _3 A$ k$ N1 @+ t
: G& l. H2 ~/ H
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 4 b* E/ t5 ^) y4 C, w
- o1 C: _/ P+ a2 ^. |. F x: e& f -a Resolve addresses to hostnames. 3 ~1 e- D8 g, j( j; r, s
' u1 @6 X' R/ s0 X( X# P" m
解析计算机NetBios名。 6 b! Y6 q, ~& v0 c% k0 q- Q
1 y& c ~! r7 r i# Q, F
示例:C:\>ping -a 192.168.1.21 / C8 Q( h/ H* Y; E- C c- s. i
6 a; b+ p# X6 W/ Q/ l Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. \5 d& t! d. Q6 q; _9 b " Z5 Z2 u6 L& Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 L- I2 d& |7 U3 ^# j
7 w( `$ t( H& j2 F0 k% ]' \, e: w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 & o2 J. u% X) T- e& Q& Y/ x; n! Z
7 x! [0 E8 P. X) v/ h1 ^' _4 Q1 s6 W' m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& @+ Y+ n5 b9 q J$ u/ M' U+ ^
4 M6 u/ c2 M: L . Z$ L5 T. N$ ^2 [ Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 ?1 C7 j' z1 w( I; S
4 t4 Y$ e! z; _% C8 N
Ping statistics for 192.168.1.21: 0 F% u8 E* t7 w/ U; ~
& q! z" o1 v" z: Z2 {9 ] Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
( F, c* U6 k' a1 R
5 R. h9 u1 K8 N; c% e6 I& Y Minimum = 0ms, Maximum = 0ms, Average = 0ms
( Y4 L$ P }( S* w ! a* v' u$ c4 L2 B3 _
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ p" o# r0 r2 Q3 R
1 s# ~: S; ` H+ ~" Q) O4 |, S. q b -n count Number of echo requests to send. . H# A' P1 u t/ t; f/ N' {5 W
+ o" k0 `0 `8 } 发送count指定的Echo数据包数。 # A$ e2 k7 U( z' C+ d( F
2 }7 @; p& j: o. X2 y0 j( ]5 r
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
. J8 D% a$ E5 [, {( q + r, `' t5 v3 P5 h
C:\>ping -n 50 202.103.96.68
: Z# B. t5 e8 o8 g/ t- z1 E( v
( K( t7 g+ a5 R, l Pinging 202.103.96.68 with 32 bytes of data:
; w- w( c( m: E* `% g; ?
1 K9 ?5 w, r5 Z: q' x- i1 V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; `4 V5 d0 ?9 M3 \! p
# ?" ~1 e2 _9 @8 e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 e0 r8 z6 E5 P* }
" x% l5 S# X& \/ E; A' C; r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- j! o/ f* S- a2 X9 I& f ) a8 P- P3 \8 q# V* ~* h: Q
Request timed out. / U0 S8 M7 G" N; A3 D6 l- ?
7 \; a/ G" b: W: N ………………
/ Z: j8 u" E/ ]0 N! B7 U8 `1 a
- z$ k5 L: `' U3 E b) ~& R' e) b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # W2 ^5 m7 W( N3 L
2 i* A, R5 S4 J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* Z" V* a5 q. b# r
; U+ p& w5 j$ m" M* ?( F( M3 W Ping statistics for 202.103.96.68: ; U8 D) m6 h" l) @7 Q9 u4 r
6 J, b5 G; x7 F' d! Z+ B0 U) N
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
* q3 J/ }" I1 o7 @
! J. I7 g' f# L: b9 I Minimum = 40ms, Maximum = 51ms, Average = 46ms " D( m$ z$ {3 o# `; t9 Q! ]; |
; s$ i# |8 k" {2 a$ d5 \' y% Z
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 V0 P) |' u2 x, w2 @
3 D9 A+ j- L" \. d2 H
-l size Send buffer size. , c9 a9 Z( W6 B3 G/ u) C. l
5 z& H. e" V9 I3 G9 d7 J0 g. V/ k
定义echo数据包大小。 |
|