  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ r+ |0 L; Y* `8 G1 A$ p1 A 1 K0 c" F: t! p
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" e& O. a+ k+ [' s4 z
3 U( ^$ F2 x2 |8 H, u 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& U: @, }- j0 U. k
% r2 _" S! x: V% f Options: : _7 C6 v& }$ B
+ V" D: I, @. a$ ^/ e2 @ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 d. k" C2 \8 E" V9 V( H! T
& C. N& b0 e! F, U 不停的ping地方主机,直到你按下Control-C。 4 p$ l- M8 W: f/ ], h: T
+ m6 g) F% r+ w- y9 c; X% Y- C
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 D; m2 g# ]% N: U# F' e
* M+ P8 M" @0 q5 | -a Resolve addresses to hostnames.
9 N' c9 Q, h, N& g# B8 |
9 O8 s. o# \- Z$ e+ P" P' Y8 C 解析计算机NetBios名。
/ ^, v7 _, C2 n
2 V# F* e* S- W- V2 B 示例:C:\>ping -a 192.168.1.21 & @' Q" h4 A7 u8 i
6 X* Z Q6 q5 ?6 H) e; o8 n
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ; a1 ], I% o9 C* L& e( p& i
" ^5 }/ K4 A0 L9 j1 `- E6 g5 D1 v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 |3 {( K8 |7 Y8 t! Z1 _, A + D- r% y4 M* j# F! s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 ]: p s2 }* ]
& t# r* K0 ~1 _; w$ q3 n9 G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # s2 M& O3 @* j+ A# z- b$ w- s
( w# ?2 i( z. X) Z
, D5 E) v- G$ x% ? Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 m7 J. s6 ~6 g: B r g$ g/ @. O
) H& D- j+ O W7 g& `
Ping statistics for 192.168.1.21: 6 V: `2 D4 h3 h5 L$ Q
# ]1 T1 `, E* K/ k& X
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: , ~1 w! u) ?, H6 _/ P, d) F" q+ o
6 W- v0 d) `1 B( J
Minimum = 0ms, Maximum = 0ms, Average = 0ms
) K6 v' k0 M) }+ C5 W ' s: M: q/ i6 M& o- _4 |
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
7 _6 ^2 v, a4 w! A+ w
! i# L$ \2 q6 V1 N" W) J5 N2 F -n count Number of echo requests to send.
0 N, g' q1 d: v E
' J7 j+ F. C$ K* E1 x2 A ^; G7 O 发送count指定的Echo数据包数。 . l& l, x9 \5 s3 e F
P; C7 s* \4 q1 N) b- g5 N$ l
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 5 x$ s' H: H+ g9 G; Y2 M' L% a+ t
0 u3 D8 W1 i- W6 C0 a1 G
C:\>ping -n 50 202.103.96.68 6 i; I0 U, ]( M
! |) U% R) e7 w; m% y* d0 k Pinging 202.103.96.68 with 32 bytes of data: 9 A, z; z; a% t
1 S: O2 c: ~7 j5 X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * M0 y# X4 A' Z7 D0 q% Z$ ^! f$ @
( e6 H+ h0 M+ S" W( x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
K! {& X5 z0 T+ ^/ D/ }. f6 O3 c3 i
2 m, B b9 U0 ^* Q; ` z# R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 Y; f4 D9 @4 E: q. n/ l c$ H$ i: Z# i! _0 y6 [0 p: s
Request timed out.
3 Q/ Y7 C" K7 e5 S7 y 0 n) u: f6 H3 j: H3 K* U
……………… 0 B& S. k Q3 V( h$ y
e" }, N W3 m3 r c! F; x; O$ a" _
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* F3 d0 W5 |, a
* y3 A* K, j8 U* ?, {. \. q* m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) N9 b' }( s( Z# S/ P
7 \; M& n. o% O
Ping statistics for 202.103.96.68:
% m) S+ ^# s' S. E 3 W0 T1 A) U* f* P3 m/ s+ f2 s! Z
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: * S* c6 j2 s _+ F6 A' z. i
7 ^9 V+ a* ?, U- v$ l, s; h3 o7 q Minimum = 40ms, Maximum = 51ms, Average = 46ms # ?3 ^ H& D+ \0 m ~* M
8 Z* P! p* Q" O( b# B* | 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
6 V; F% g1 { h* L' x+ n9 {
, i) p2 B7 J+ L- m -l size Send buffer size. & K3 l: g- \9 i
' p8 y2 B" Z9 P b9 s
定义echo数据包大小。 |
|