|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
* f( m5 P0 V5 r 7 U$ C& d; h% L2 Q+ M
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: / N1 I, k$ a. h, ~
& c) `' D* Q( @ 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 Q f6 z' ^/ N
- |4 Q( d1 r2 l" ]1 p: f/ U; F
Options: . d; [( q, v, m( W$ M& h8 ~7 Q. p
" S, Y) m- V1 n" n( b+ M
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 f) t" s0 h, a$ }4 T; ? 2 b6 ?3 D- n/ ^5 x; M* ?
不停的ping地方主机,直到你按下Control-C。
( m' f( Q0 s; _$ m' g : A8 D7 Q4 j5 \1 D( p) X
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
" ^4 d: F7 |8 K& d* C; I ' c7 N7 |8 c( f7 U
-a Resolve addresses to hostnames. % _3 R" V7 Z( z0 N) t0 B
* c' {, z) V8 L4 J
解析计算机NetBios名。 * s; W' Y; N5 O& o" W
; S8 O$ C- b) Z a2 A* d) _/ j 示例:C:\>ping -a 192.168.1.21
- e" C# C) @& B, C
b0 G2 E6 N2 G7 l Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: " _1 T. K: T3 |1 n" A, {2 P
; O$ U3 T' _# E* X2 F0 J9 ~# z. A, c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 r2 Z- A+ A, J& p4 z- a / |) U$ x! z5 \/ ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 I8 a* P- Z( Z* I- f3 ?- v 7 o y7 x2 i; O3 ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 Z) X* A6 n7 K& c I+ B
% V; c* E4 e& ^0 q - X2 G9 @+ o7 e0 H3 T1 W( s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! q# C; l# P x; {6 ?4 I
& V+ Y$ h6 Y B1 x; W) N
Ping statistics for 192.168.1.21: ( }4 i9 a2 f" w4 b# ~
1 Y* V+ p- ^0 A1 }, w# y Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
$ J* A" P+ W, e
9 k0 v6 f. S$ N, d; g Minimum = 0ms, Maximum = 0ms, Average = 0ms D+ k0 {0 _4 {4 f% U# |
: K& |6 a. m$ W& S
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . W5 V0 ^/ |' s- j' i1 o
- x" c$ T4 t6 d) H2 f( n0 z -n count Number of echo requests to send. p& U4 c) S$ | h
$ o) ~; Y8 R5 x. T1 A
发送count指定的Echo数据包数。
0 e/ `$ V$ V# L) v" J. Q! N ( b4 r! J8 G7 _6 l. L+ k
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) q/ U4 I$ E3 \/ F W
3 w; y2 ]9 L& S, V C:\>ping -n 50 202.103.96.68
- N8 C- d3 B# y- ~3 q: _# d
2 i. a5 O4 `( k/ o9 N/ V; Q Pinging 202.103.96.68 with 32 bytes of data: ) O2 s! S& {4 U* ]& n6 s
' I/ _, E/ h* a, ?4 K% L1 [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . D6 R: H% e: v, d
) _7 g6 r! B4 Y7 S Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) z$ t) b! ~, ~- _8 Q! r# ]
+ `3 v8 z7 g& d' r. d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ L: {! s1 ]% z# o+ O
2 m2 E1 S; R9 K7 p1 S Request timed out.
1 j+ r' g6 G- v- Z6 o! a0 |
/ O. x$ c, C& A* t: b, J ……………… , ^5 @: h, K% f! d7 f, r8 t' n# r
0 e; N" |" \2 C |* j+ P" _% U
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" W! U R1 [$ m& z * O. e% H# Q5 J/ C1 O; W4 ^* P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / n+ G/ w" D d/ |$ I& S9 R
, _, b) q: B& B4 A
Ping statistics for 202.103.96.68:
: M! T6 z: X% `3 M
% Q d0 Z8 [& N Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' s* |4 Y" f" @* E" |6 d9 u2 ]. _
0 j# [8 u' t5 g, R Minimum = 40ms, Maximum = 51ms, Average = 46ms
( n$ K( w: g$ m- O
7 F' I. t& q m 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ L. F# S8 D7 I. e$ T& y* r/ V ; Y) }. K/ w1 I& B* D# T+ P
-l size Send buffer size.
' m2 @" _3 I8 L( ]3 ~& w5 P7 Y 0 S# i/ T8 l* O2 l& @5 J. U
定义echo数据包大小。 |
|