|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + H7 p/ D7 D; q( ^% m
o6 ~# G4 [- }+ G: M 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: * g9 N" ^* c6 K+ ~' C9 Q
- o; y' C- \( f
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
. D( b5 T& C* j2 p
7 c% Y6 W7 R5 X9 B Options:
m7 Z5 q, o# M& S" S$ x$ K% O
6 M/ [( q9 m; q( V n -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
$ C( |8 A1 N4 N/ e
/ J/ A# b% h+ }2 X3 e1 D 不停的ping地方主机,直到你按下Control-C。
. E3 G" \+ S+ W; p$ @0 s2 y
& U* q' o+ ~7 e* }) P, | L 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
3 n& a6 B" J6 u. J/ j w7 D( m# t2 z' R
-a Resolve addresses to hostnames. ) M0 Y7 E8 m7 D) O _" l1 [: O
% s" W' [7 i% J4 G3 G
解析计算机NetBios名。
( w- B' m3 s. q. w) M9 I, d * T3 @: [! [: ~' I
示例:C:\>ping -a 192.168.1.21 6 A" R/ [* i( R: `+ T3 b- Z/ o; s
' @! Q3 ?! U( U$ w) V% X3 @ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
7 i+ F; u: W8 R8 y/ d7 |8 m$ C - E) v3 D# s) `3 @. a" a* e8 x
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - U6 ~0 x: l) e& E/ k, u/ N* z
9 |3 r" x: m- O* l* m! M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 E* s8 a- L* `( b6 O2 z1 S. d
! x$ b! R# z- c6 I3 Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( U5 o0 A5 b" n( c+ @& V/ ~# C
$ C# Q0 K" v( D: b0 A
# h+ P0 A. ~- i' d: b$ ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ P/ [# S& ?* s
: ?# ?: a" d2 M1 h# z Ping statistics for 192.168.1.21: 3 t9 M5 D( [" Y, r- z: H3 o% a% r
+ Z G' \: l1 V# \' Q7 A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( @ e- u9 b# T1 f6 H
% i# @8 y' A# x1 ^8 }1 d
Minimum = 0ms, Maximum = 0ms, Average = 0ms
% v. q" C% R; C. z3 ^' ] ( a, i1 G. a' M, n. W" |+ p
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 Z: N7 K) w9 l8 b
, Q0 {1 J4 R. F$ f: k6 r! b7 r -n count Number of echo requests to send. 2 g" U6 N0 f* o" \2 ~6 Z8 X' I. S
* R% M, o) d! v: I( e2 Q
发送count指定的Echo数据包数。
( k9 ?) P; W/ a/ t7 I
+ R M4 p9 b# W5 _& ?& y& S 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) o/ b, C; w) ~6 M+ `- e/ O
4 m$ Q' N5 W6 S; @4 w
C:\>ping -n 50 202.103.96.68
" h8 C3 {9 i9 [- H# b9 q8 _3 s
; _. e3 `' f6 S5 G4 U1 ?, C% H6 E Pinging 202.103.96.68 with 32 bytes of data: : j0 c7 q5 y- p4 Z$ b
, m v+ A7 _' A" |4 I/ x7 ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # g3 W8 h0 i% X% L. w$ d/ u5 O
) r: Q W+ n1 M8 `4 w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! h) ]" h) M S3 C0 y: v
. Z' f. s; ?0 Q& t: T! _* } Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: S# a1 c7 c( c: L8 d0 P
/ b1 g. [' O0 k) u! N Request timed out.
: V* g- U- O( n, w! ^: I5 q+ L$ ~ , z. X5 `8 f' H2 y/ L, C
………………
9 \! `; k6 k: [) W' ~9 A- R* ^ # T5 B9 o2 K4 [) q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) v/ _- Z3 x- p+ T
! F$ G- {3 V4 c& [2 P: _, I+ J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& G& D- k2 `* x3 l $ r4 u! Y; g1 a
Ping statistics for 202.103.96.68:
8 p# }8 M- x; }* F5 k
' T/ E2 s" J, C# \ Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 4 w' [ i) L- Q
! v# Q9 |" U9 C* l {( }6 [8 C9 E; K
Minimum = 40ms, Maximum = 51ms, Average = 46ms
' P; P$ Y/ x2 ~ 1 R. [- P* p* t& ?% @. X `& H
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
, V/ k' b7 k, E6 Y; g: D ' x; E# y n) r4 ^1 A+ x
-l size Send buffer size. 1 l6 T* ^! ?( T4 E2 `# h. n
/ h+ J& {# ^: W9 ` ~) P5 Z! X0 O 定义echo数据包大小。 |
|