|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 $ t- ^; @* l I1 X( t* g0 G1 W
( G+ b# C1 g3 H$ d, k 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
: M7 s# k4 o n! O5 u' J
, R$ c* `6 j6 B) A 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 $ g1 |- l, P j6 i9 p
$ B; P2 o8 ~7 A Options:
4 h$ I2 y( T: I: o/ h g" f4 o
6 ]0 h$ p* l. X -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
3 \6 e6 K3 {4 g0 J" l ( m4 a6 ~& H; j
不停的ping地方主机,直到你按下Control-C。
9 g8 E. j. p4 R' N
; T( r; A4 S0 X, u! p 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 $ R) E4 ^( {1 @+ v; N; o
& B; r: l6 e- h -a Resolve addresses to hostnames. - K; Q4 w! E: [
8 u/ e, {4 u7 ^% Z
解析计算机NetBios名。 8 Z/ ^/ Z& r: `7 a1 v2 e# Y
1 |) Y7 a* P/ M, u$ L3 R 示例:C:\>ping -a 192.168.1.21
- [8 r7 ?8 H0 l) n$ x
1 }4 m# |. }7 n. ? D% l* X+ E- @ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; X8 e; U* G/ f& O# t8 h
& O% o4 X/ D- I" O' a+ F7 v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: h+ d- Z; i" s0 t2 e
; t/ e" y. e6 ~8 a Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# d& i, ^; [) U. L
+ ?7 I9 ? B$ e0 M/ H9 O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % g7 V" @, M- X+ V
- H" @% z( i* g' z) C
5 S, R3 x' K$ Q' P/ e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# r' o7 A8 o0 x, r # w6 z; p8 e* q" B/ |, c2 I
Ping statistics for 192.168.1.21:
5 @, F" v) u/ y E
1 a3 j* S; m" _8 z Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % q$ E- [1 r% n
y9 v0 _/ }1 V, q Minimum = 0ms, Maximum = 0ms, Average = 0ms & L) G+ W# {/ T
. ^! ]* O% N+ z: z9 s% | 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
; t( C6 Y1 c% p+ t8 m; G/ ~1 }6 d ) z* Y) \ u4 X; N
-n count Number of echo requests to send. 4 l9 g& s3 d1 { ~) j+ q* c" c: |
' ~& `5 d g4 w 发送count指定的Echo数据包数。
; Q# y/ T; N! F4 m+ ]
# ^0 U4 e0 }8 e 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( g# U5 o$ q1 u" g4 s9 ~ ; y C( ]0 s( s6 @# T/ Q
C:\>ping -n 50 202.103.96.68 + i, s+ \& b ^$ e" T) z7 |% R
$ k' Z8 U0 f) w7 C: A& ]
Pinging 202.103.96.68 with 32 bytes of data: 8 _- ~+ ~, X- @0 j5 M5 J) Y) H
: |8 b% L# D+ i+ @; r; Z; Z* G9 I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 D& N: J3 z) |1 F( E' p3 j$ i6 ~0 {
% {; I! Q0 ]. q. M" W N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! x3 c8 A& n0 [! I; r6 Y9 Y% t
3 ?' L4 t" o' V, }' e9 w M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) p4 r) {5 v! v7 R
* H: P7 i" Z- ~6 R
Request timed out. 0 [! ]8 q* X# i
; z( ?9 a u7 O2 i
………………
" E5 Q( A6 E8 g5 `$ l! k
9 j& h; l; c+ t& i! {4 Q: z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) `! ]. g% P( } ]
|6 D3 \( b3 v' S$ w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" [0 N7 t4 x' d2 j # M7 R% ^- H3 z7 x
Ping statistics for 202.103.96.68:
+ l0 J& H" z1 W; [4 P' h
4 g+ N8 n# M4 t+ d9 @5 N, X* g Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ! i. H4 C* P2 I2 w/ A4 m2 x) s
- i; N! M+ e3 |0 Q Minimum = 40ms, Maximum = 51ms, Average = 46ms
8 e f1 ]* {: T7 s! `4 G) A+ i 3 x7 G8 Q! f3 Y+ _7 p( g( d8 R
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ; h: m) [3 j+ t4 O5 u; q& r2 |! N# A4 x
6 e. N$ z. |6 U3 j1 G6 K. t -l size Send buffer size. . | U8 J' @' q d* B
I1 h# B* R. U8 z S9 B8 {
定义echo数据包大小。 |
|