|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 y3 r) i x3 m, ^0 U' G
. R5 _0 v/ G4 a9 j! j 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
/ q# h) k' g4 J4 q* \
3 \3 a- `' O% ]2 W' x4 D6 p 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
! @. C& X) s8 r n5 F# b3 L9 ]
6 x P: Y* m$ |- A) D V Options: / v4 Z0 f+ Y% @# F
) z o/ @- Y! S* `" N1 T) W6 W' N
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ) N, P. P" u/ @5 P- _
' O) H; Q0 d. h
不停的ping地方主机,直到你按下Control-C。 0 i4 R7 [1 ] B$ O% e( \! s
' F I( @( f( O. p
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. |9 L }# H {, M/ _ / u0 [% _5 c; a/ I4 D3 n
-a Resolve addresses to hostnames.
# a. ~ _; l( C: J a
" N* A, E2 w. B; R0 h3 l1 a 解析计算机NetBios名。 . m, t7 \1 g4 I; j8 ]
! N9 A% n! b+ p4 _8 {- r1 I
示例:C:\>ping -a 192.168.1.21
3 n8 @6 ^( p8 f, z2 \2 {
* ~# g7 d3 @ r7 P( e$ B5 |) J Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
' `0 o. n0 ^9 S8 ^
. Z+ u/ a" i" U9 a. Q) W6 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 z4 i" L$ G9 \' o
* ]2 `! ]0 @5 j2 H Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 Q7 {2 f# @/ U0 D: C/ D
" ]% A% B( u' g" k) T( M0 b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ j, q o" z: h
6 M( a: l! d) Y& o# X( O8 L8 {
0 w) K! A; V1 x% e9 @0 \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / R' @' j @" ]3 Z4 U5 B% @- `0 ]* w
/ v: E# J! _1 B' C- a( k& e Ping statistics for 192.168.1.21:
# H. E# G* ]% R1 k
6 B, V# F/ T2 C$ G. J6 a Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: $ S( C2 R* p/ n. @$ v5 q% W* ]
! C0 }$ D6 N( R5 Q. v' | Minimum = 0ms, Maximum = 0ms, Average = 0ms ; k1 L W9 b$ Y8 |- R9 w, [
5 _% p1 q U5 |8 _( R2 G
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
# S9 H K! P! o: Q: A " X4 v- E2 W2 A# @& v
-n count Number of echo requests to send.
" R- l% a0 v- D5 v( a2 {' w1 S2 z " q' n6 `# ?$ E
发送count指定的Echo数据包数。 # v3 d3 V d. ]7 D; E
! r% E: E5 I7 b
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 7 k F6 _/ L& w1 U* ~7 @
# h' J" R% h. }0 ^
C:\>ping -n 50 202.103.96.68
7 @4 c6 o. h! @' K8 T& v5 w ' m( X. b2 D8 w( Q0 T
Pinging 202.103.96.68 with 32 bytes of data:
. `7 W, R( ?8 F" r& ]) U
! n: x* h: |% f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 T! a/ N [" S, v
6 u+ X& e, f+ W Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 P0 ~& U/ }8 p4 O" v
( C+ h1 ]! g1 _5 f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: q6 L! H z9 U3 i; f
5 V9 g5 y! k" S2 k& Z8 r Request timed out.
5 H+ `9 E$ L$ u- ?
" D9 a' m3 C2 d& D, z ………………
2 ?( `, |) O) `% c $ F8 i$ ^# p Q/ Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 F+ `- _& L: W
T4 e9 s1 v: E P) \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 q7 X" Z- l1 m+ z4 k" Y 3 v" } c# x2 `9 D' z/ U' b
Ping statistics for 202.103.96.68: 6 Y* ^9 n! n) \- l. y/ M
+ I7 c& {1 m6 l. @% _3 _* u. G
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : {: U0 Q6 ~) f: y$ N5 t6 b
7 ^4 |0 P- N1 @+ c% \! w
Minimum = 40ms, Maximum = 51ms, Average = 46ms
; n4 N( x. Y7 c. a& L- |% w
$ g1 A G- v2 p! S; [ 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& ]* v- F- A: H7 v- q2 j" D 8 N' @' ]" f8 W( X/ A& m1 ?6 F- c
-l size Send buffer size. 5 A3 }5 h6 v: E; L+ f" c
& P) ^- D# s, L
定义echo数据包大小。 |
|