|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
& H3 q6 m7 e9 a4 T2 W
7 ]$ Z8 f8 h, I7 e, p+ u! j 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 Y' w o. }$ C3 N3 b S1 q; X
! |9 U% P' _ 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
9 Z ]* G' L& [0 X8 k
' O7 _) Z' D/ T# n" E Options:
1 u+ [9 Z! p! s3 {, B
3 u7 T8 O/ c# p: |( e! t -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. X- x* P- O! c9 k* A( Z! F& ]
% [% f7 o, u0 k5 g0 K- O" ]- s 不停的ping地方主机,直到你按下Control-C。
- A- T5 E, ]3 v" ?
' q% N% Q4 \- } 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
8 q( Z7 b3 W3 \" h4 o5 C 0 D8 Q& n4 h( g9 o1 Q
-a Resolve addresses to hostnames. 1 y; i% w, N0 l; ~$ G/ H/ A- L
( X, X0 q- o6 S$ P
解析计算机NetBios名。 - F& J( k* m$ q- w* q
( C5 d7 m; [$ N, G. u3 j' e+ W 示例:C:\>ping -a 192.168.1.21 ) ? m* P9 a9 N
7 l: g! L% j3 E Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: + ?, Z s5 n t8 h3 g
9 q* H4 W; D+ f: i- i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' s% i: x; P& U0 H: ?, i- H% A: f 4 s0 z, |$ B4 q; L0 c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 \; M; O+ [' p3 T J! N
* ]2 }$ G/ d" V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! s$ X! @+ R3 L5 Y3 m3 O$ {% Y- Y) l/ c F6 P
7 _' t) c1 l3 J0 M, w$ C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ R; U7 ?: m, b* O* I% |3 v6 `
1 P! `1 f/ p# n3 u) s2 ^3 t Ping statistics for 192.168.1.21: . b4 c' @3 Q. p9 D. V
# _/ C/ ]" L; L. r Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ; b' B/ D, j6 J" W3 n5 Y
& I8 X* V/ D' ^ h% X- ^
Minimum = 0ms, Maximum = 0ms, Average = 0ms , R) v# T3 @3 U1 M) h! x9 p
! {4 E* D! D' p
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
9 U6 Q. P9 c* i* l8 e 1 C. A. z. f& P1 }9 J
-n count Number of echo requests to send. ) e9 X: {5 v, }2 E7 _. v4 T/ k5 r
$ a# {/ A6 I% _
发送count指定的Echo数据包数。 & @7 r& @9 m/ Y4 ?* B( c- I- t0 K
$ I& ~. j( n8 ~+ }
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) b# {5 c8 O5 M
7 ~! I2 {* C4 e1 p; ^# k C:\>ping -n 50 202.103.96.68
7 I; v' L3 v- U" t 5 x0 D( q0 ~ W
Pinging 202.103.96.68 with 32 bytes of data: - @7 s. l) Y/ }4 E5 A }9 X
, U8 [% v3 J6 B4 f' o- Q9 t1 w5 Z3 g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 ]- K* r" N- O" ~/ a" O # K2 X4 c8 O8 W1 B% I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ E' ?) P4 i' ]/ a! |. n
2 R: o$ I' G' `% L8 P/ E# O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 h1 r+ L8 L8 H+ _4 c
! ] Z+ x; U6 ]2 K8 M. g z
Request timed out. 3 Q% H; w Z% I
& a2 g: ^; ^, V' \7 b; c
………………
) B/ N9 N/ _/ C' {: H. I
+ l: v! T3 Q) H$ i6 J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - \& f# r. L/ p1 U# X' i, f+ T6 F
: I- E; L* W6 d. R- f' z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / i% y, [1 E" N( ~/ Z. U, {4 F1 I
( w. i6 P, m1 [- K
Ping statistics for 202.103.96.68: ; `2 ^2 L E7 n0 a3 g% P$ m$ ]! x$ l
2 U5 ~; c( x5 ?8 a% c! s6 M; T
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
* }* j5 S- P, S* F, d V: l8 x& [ . }9 m6 ]. ?, E* _4 ?
Minimum = 40ms, Maximum = 51ms, Average = 46ms # d( o( N7 g8 Q3 o6 G3 `
! o+ r3 F$ Y5 x1 r! { 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
; X) s( h* K% ^7 X# y$ \; Z
6 k6 ]' {4 q* a1 ]0 \% H% R -l size Send buffer size. 9 w1 ^4 Q3 O. ^5 l
. u% j' t0 T9 w/ U 定义echo数据包大小。 |
|