|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
3 c5 l! I: \* D) K, n - x# S) w8 E8 C1 [
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: - P; ~! u! i# h$ n
* @. H' a6 U; _- [& N! j 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
8 P' Z; B4 y9 i
) S- F& m1 C! [/ ]$ H5 o9 C9 J0 E4 j Options:
/ G% J0 Y" F/ z: d# C - R) t& t0 T' ~) D
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- T, Y2 l" ~& P3 r
8 ^1 L, L6 _! x% o 不停的ping地方主机,直到你按下Control-C。
& O) k4 B' A" D 4 W3 N2 o+ l( I' J$ B8 a: ~
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" y: K. d- u+ D, h
; O, @% S" j6 U' c -a Resolve addresses to hostnames. 0 k% f7 d/ O+ @$ F. W
k* { F) T; I0 | 解析计算机NetBios名。
& [+ O7 t1 s4 O; n " W( }+ @) t3 g4 N8 P* J4 l. N
示例:C:\>ping -a 192.168.1.21
# A4 ~4 K! z9 r9 S # \0 }) \: h* s6 m$ o; q
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; l( ]3 h2 ]. @+ ?) d1 n
( i( ^3 ~" Q) N4 ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 b3 v: ?* R* N8 U6 y
+ o [ P3 D# m4 G+ {. M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ R: [- e; o& m$ u: e' t
! u6 R3 P" s$ u. `: `& B Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& F4 _! ~8 h/ |; ^4 ~8 ~
, ~6 k9 |2 I8 r7 _& |! n# \ H) s
6 r" G/ z1 u) S; N) \" J: W$ u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 k. h% P" J- f
; E2 X* _% |. W/ a( E8 | Ping statistics for 192.168.1.21:
% O2 a9 f: f4 @1 j. m# S4 K# ]! g 4 ?$ @: b5 X2 w! r2 o
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: # e6 ^( C/ }% l d/ x2 Q# W
# y7 u8 ~( I, [& Q
Minimum = 0ms, Maximum = 0ms, Average = 0ms 1 Z+ G% F: @0 P- E9 v
( ~2 m& z5 L& T3 u& B' c0 s a 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ( b3 T7 _. U9 L8 P
/ j! \( ]( N+ O -n count Number of echo requests to send.
+ l7 ?' N( P3 U7 U
( y: @1 O( u* q/ i6 e* V 发送count指定的Echo数据包数。 $ a8 R) B7 I) ]6 b; e% r5 a9 z6 h
8 B6 }* ]6 d$ A1 ?9 D6 j( \* t
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: $ r5 i- w6 B- e) t0 S: s' U" K
2 P1 y! P3 G* F C:\>ping -n 50 202.103.96.68 ' \/ C! A9 H4 ], a8 F, w, Q
2 ~ j5 _/ b( j3 K
Pinging 202.103.96.68 with 32 bytes of data: 6 C8 a0 g0 D2 g: ?2 j
4 J& ?. g6 v) K" V$ e) d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 p5 q" c* q! C- ^. r6 D* V1 @ {% [
K: e2 \: w/ P0 P Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' w3 f; l/ m4 u) h" P& r# S5 E
: e2 ^) }$ s: e. w8 H0 Q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' g1 | y% K' g% f5 a! a
; U" h5 s0 _$ x- P: l- L Request timed out.
" k" ^6 Q( v6 _( J. B3 t! P ; L( J* D: L5 h8 }8 v/ @" B
………………
4 w/ p; L0 M! f m ' v9 V0 K: T0 t z: \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . Z3 v5 O' K/ U
7 P- Z! I/ j6 b; D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 O% c( X! ?) `2 P
$ o4 U& B( D: {/ J$ q Ping statistics for 202.103.96.68: + c5 A6 N: y5 d. l: h4 H6 M
% f1 t6 a3 B' q6 G
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: T9 m! L6 M. ~% T
* M/ [ ~* v/ n8 w Minimum = 40ms, Maximum = 51ms, Average = 46ms
( R' D; p7 v- z9 T
$ ^, H+ E: R9 m# w 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
; |" L% K! D% q' _( [; W # [% h& Z I" }$ j
-l size Send buffer size. . }5 P* p% P- [
2 A8 Z# w; ~; y/ T/ M+ F! Z# ^/ b
定义echo数据包大小。 |
|