|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 {. O! O6 \& w1 J4 \' U
' n9 ?4 Q! K6 Y1 }1 s2 }* W5 v% ^6 |
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
0 ^, M i/ J" _ : S* X8 y2 M& e
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 & b* r9 Y* ]6 w2 z& e3 U4 Z& q E
4 X4 Q/ W7 O: W3 G. O6 h Options:
: N& {% [7 s3 S& }5 e, |
4 H: Q' j, B% ~* V7 I* w+ F1 ^ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ! b. y7 {) M6 [
V+ e' a9 U% i1 q& O0 F$ o) b( T 不停的ping地方主机,直到你按下Control-C。
+ _# C" u7 N( Q' H+ P& Y9 G$ R ; V: k. ^" y; C0 w; N9 f d# j/ Y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 Z6 P& N+ I% y% F) I( g0 f! k
' W5 S% } x; @ k -a Resolve addresses to hostnames. 5 I; F; t, `5 z, P
7 X* }, I: V1 \ 解析计算机NetBios名。 8 P) s; y4 V' v5 _
, z" K" v$ R9 I0 x' k* Q( |: f! Q 示例:C:\>ping -a 192.168.1.21 1 A& m4 H% K& m1 h" e
8 E& Y' n0 w8 e/ Z1 z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
' M4 N: E, {1 V4 @0 i! i, D
6 d* [/ ]# X" [; @- f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 z" P& m4 E9 j1 }8 v4 ?0 r
- P" Z3 T" F2 a Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 ?5 B, |: T* h, s9 Z: n2 v 3 } y) a+ L# I+ H9 P q7 j! {8 m4 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 p U- T, H6 T& g- m! R5 j$ }1 ^2 F4 u6 e; b4 f2 j
/ \( [8 t$ Y0 i. P3 Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( f. R' K7 v- c! T
6 s7 g. W0 Z9 C3 c
Ping statistics for 192.168.1.21: $ e% v% v- c' h; U
# A/ ?3 A' g# e9 X3 o Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: * P4 ~* y) F1 R x
/ v. q2 s, v) l/ Q8 Z) E% v" m( }/ n
Minimum = 0ms, Maximum = 0ms, Average = 0ms
5 R4 j( ?: B$ f3 u4 L' t; |. T& ?
; X2 G8 f' o/ g/ O 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # m* Y- m9 a5 _# q: b
( u1 F( |1 s1 }, Q$ A0 F -n count Number of echo requests to send.
^$ y4 a5 O9 E, [$ l' L6 A
; r1 ?5 N. z0 T( j0 ` i 发送count指定的Echo数据包数。
\6 s3 N0 a2 U- Q 7 l) K1 C* u2 q& i. \0 a9 M! ]7 f
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 h6 i3 U9 G R+ h3 G* q 8 I6 _* k$ R$ @. e- A9 d
C:\>ping -n 50 202.103.96.68
$ z+ m0 h/ W3 U" x; E) A
. l* d" k: r1 t, z1 V) a9 V2 ~ Pinging 202.103.96.68 with 32 bytes of data: - b2 K: A* |3 B2 B
$ R( g' g( `* H- f& B& d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + W* U) I ~ V" q
4 N! |3 J9 I6 o; N) u: Y0 W( M0 V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 K a: z% k; ]; S: z1 S: {% @1 I& ]7 x
* m: { D# s6 ^4 O i# u: w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / ?' [# w2 ]) n: y+ [6 ~! n0 Q
5 W* \6 V9 r6 h8 `+ L/ V2 j Request timed out.
$ H# Q5 \. Q |- z2 v) ~7 d6 c
# n. @/ J6 @$ J2 Y9 ^ ………………
% ?5 R4 m0 P* ?7 g
7 b$ h+ x0 R6 L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( n& G/ X7 j. A7 B- d/ x1 e% m ; p2 z* W+ }& S' k( N1 J, |
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
_" L% y" [: {( x6 W+ o 3 v4 k5 c, z: G+ C& T% Q+ ]
Ping statistics for 202.103.96.68: 0 o" x$ E* E. G( @( |% \) K! F/ O, p
# b! C4 p( I6 D Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 Z$ j0 `/ U% A2 h, t ' P" k3 l* L/ `. ~
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 m$ F5 M) i) O/ `! s , c# Z3 C+ V! E5 G7 i, a
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 . h: |$ f' K' x8 F/ Q. C6 R& a
: |% u' `! r4 i -l size Send buffer size. 1 [$ G F5 X/ g3 D+ w9 l
* a% [! G7 T/ Q! Z8 s4 r 定义echo数据包大小。 |
|