|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 / R" u/ l1 o8 w7 P% h3 p
. Q d! d5 [- X 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" W) V, Y( z& x2 ~& X2 T9 y
- Z( w# z5 W9 D/ O: a* g* r: W 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
, @) j+ J2 o+ H# K1 h ~- `; O 3 D6 ], X' j5 H1 J4 B3 c
Options: ' P$ E r/ p, a2 @. ^ }. y5 O
$ I; R8 P$ Z1 X -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
# c5 F% y, j) q# @" d6 D
# h' l) _7 G; p4 U4 @ 不停的ping地方主机,直到你按下Control-C。
, s9 w% K, F# f9 O. a
8 M* V& m/ G% m' O4 C- ~ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 O0 v. ]& E# P ^: m/ G T, _5 ] 4 |2 I$ y" \3 ~ ?# m7 k- V0 h
-a Resolve addresses to hostnames.
8 P9 G. k, N( |0 h; G% n1 P
2 J0 e( b( t, z& N 解析计算机NetBios名。 ( o6 P' |, l& c1 f
0 [& t7 Z5 H; ~0 u
示例:C:\>ping -a 192.168.1.21 - M, [' y6 x: |! l+ _7 u7 C
5 }$ S( s, a/ s& `' r: e" r! u
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
, Q' l' u( E4 a5 G* |: [
# s( t |" w! e! i Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 " O; }+ X) E+ [! W& t5 `* D
% F6 J+ e9 v) A6 S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 3 } @7 Y |+ j3 D3 X8 l: P
" D/ q& t/ i0 [+ t1 f% c8 A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' c5 e2 f' L& Z8 R b% z7 a
$ h9 N- q/ @6 c5 ~3 Z. r
2 N) q: a3 s4 f- d9 } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % X5 E) }) I) R' v( ~! L
3 n3 g1 m- _( D$ a# D0 S d; R Ping statistics for 192.168.1.21: \/ W' M5 i* a: E* ]# @3 e$ t1 I' p& o
% J' J9 V- g" c0 E6 ~7 {% N+ k8 ? Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 d& H: \$ i# z8 q0 h / w1 @5 t9 c1 P8 f/ A+ e4 P% m
Minimum = 0ms, Maximum = 0ms, Average = 0ms 5 g% T2 u: i8 m) `# R- }( ~# G' p
& \+ o# Z# W8 [( x" z" i! O/ R 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 + F! s1 X$ x% ^8 T: W
) R1 g6 o3 v4 T# a- c -n count Number of echo requests to send. 3 K$ r4 t) t7 V) E) T
! g$ G' }4 _. f1 d0 G$ l6 H1 x 发送count指定的Echo数据包数。 0 p6 K/ E2 `- n) ^0 J
/ N9 C2 y5 q9 E1 V 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
5 j/ a' T4 A& V0 M( d
' a+ a5 E. W3 D% Y. e0 P C:\>ping -n 50 202.103.96.68
( O1 ^9 s, S! P3 ?; ?3 B
; A, y6 A" f4 E Pinging 202.103.96.68 with 32 bytes of data:
+ c' e1 D: s1 z: f% ^% j' ?
" G1 B+ _2 ^+ M% ]% l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 6 [1 U: l8 y; L7 f0 V s4 t3 i7 h) [
$ n8 D9 b0 A2 O, {# v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ Q/ R3 J8 R) N) @
8 {& N8 w6 T9 ~) @* u: H Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; l6 ^2 x" r7 g
8 ^& E0 ^! C. j2 \ Request timed out. n1 }4 C3 G7 K7 Y
, Q' b. S; {+ {1 C; v ……………… 2 g- l/ i3 P. k* \0 j
0 _; A5 |% j* }7 B0 K6 I6 O0 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! }6 Z. ]. y, R$ f3 A f
2 d/ p6 t8 C# z6 f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, L! m* G4 {! w2 G+ {
5 \ G2 G' e$ F7 m: P2 m! O Ping statistics for 202.103.96.68:
! B/ s# P7 G) k1 E$ E - o8 [; d S, T. Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 _$ U" }8 a; V& A( @
9 t8 f! V4 A$ g Minimum = 40ms, Maximum = 51ms, Average = 46ms
% }& m' T7 @: R7 f) A) E 9 `( R2 G" }+ _' R5 p
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
. r& H+ ]7 D# T, Q0 G
; p4 ~5 S9 j* w; M$ Q -l size Send buffer size.
2 r( ]0 Q! k; V! q b h
) q. \1 X/ \2 u# t) ^ B, x 定义echo数据包大小。 |
|