|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 * G1 z. w9 c X ?5 s
. d8 l+ s5 f( E8 C0 U) y: m
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 5 {! t' v" d8 ^ s( u2 _( X
3 u% t' Z% I2 q: K 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 N- D& F2 D; R5 V3 q B, Y5 V9 {: e
9 y' ~( y [, H" b/ [& ^
Options:
/ `2 {- ?6 u) D , ]! K, g1 L" i# o" q% |2 p3 ]
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
( Z* E; T! g ?- u
5 D: @# ]9 d9 U# }, w0 c 不停的ping地方主机,直到你按下Control-C。 6 V- b& o! i( W" n D8 D0 P }7 B W
; M6 W8 M1 g; ?
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
6 M, G+ {. |, m
" f, P3 j% A+ v3 }" R8 \ -a Resolve addresses to hostnames. $ Q t0 `! u6 t
- J8 d! `9 D( i( K7 K- z- f' _ 解析计算机NetBios名。
) Y$ |7 @6 B+ ^; w; b" [9 y 5 ]6 D# t- Y0 y0 d1 r# _" w# n
示例:C:\>ping -a 192.168.1.21 p( W6 p4 E+ y- ]9 V
. Y7 a: [2 a+ _% w8 f# ]+ G Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 4 M* \5 U0 o6 t1 I6 A. ^1 b2 g! L( z
- E' @7 i; \7 Q& J5 X/ ?2 c% S# B0 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 Q9 O3 b4 l1 f S* Z$ s+ U
" t' A8 {$ ?6 m' y) z/ {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
J5 o9 r- J7 B7 l& ]/ M e. E6 A" K 1 w& z" F2 e/ o0 ?* d. v# ]
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 A% g* G- F/ Y1 _/ q# I4 N" c0 j' I% z5 p2 I' h8 W# Y
2 g, u+ a* E; ?% S2 y" Z
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 @7 A' h6 b, @# |
& a. x- T& f" b
Ping statistics for 192.168.1.21:
; A: R0 L, E8 M$ J7 o q/ a: p
& P: H$ q( p: W9 |* ^/ N/ p$ _ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: % e4 o+ ]6 L7 {" a
; f- v% x* y) @% v* f5 L
Minimum = 0ms, Maximum = 0ms, Average = 0ms # R% t6 w, ^8 u% ^5 M1 }6 O
I3 V# V9 B" J+ r( Z 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ' W7 e' e7 d7 T+ k% \- O. b3 H
- T' X4 c- z& O( L8 E
-n count Number of echo requests to send.
: j+ S$ y3 b! {9 J
4 H8 s) F. U3 O; N 发送count指定的Echo数据包数。 3 f9 f$ f7 P$ T6 @1 O9 Q& N5 J
& h3 a8 W3 N9 D, J) D
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
+ W; ^/ i- a: _" s! R$ I
0 W' Z. w4 C* L5 M( _& ~& [ C:\>ping -n 50 202.103.96.68
- g' K# B* T7 s: G) M5 ? 2 A* y1 ~, }; a. D+ J1 S+ o
Pinging 202.103.96.68 with 32 bytes of data:
8 s8 P( b0 W# `6 ?
# I+ V3 v6 ?9 p# \! [& S. s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ b1 o. t2 d% C- s& C
. N2 d+ J3 \# E- M5 w5 _7 v Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- F3 j7 a6 j3 c, q
8 w$ F W: N) \% l ?' g Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & G# u5 J8 L0 D
+ ~6 a5 X4 [( \+ o, F, z Request timed out. 5 V2 T, c1 A( Q
9 y8 J0 M" m- q, Z4 Y) F# ]& s. w
………………
7 N, N! H" Y4 B4 |0 q9 j
3 N$ S% a6 L L# V& b$ p Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
H5 r9 l' O" N/ O 9 o( d3 J( Z1 L
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 O/ W, F6 _5 z6 w. M
' |# l; o5 j f& D* I) ?5 O* K Ping statistics for 202.103.96.68: n2 U$ k, C/ _" o: ^$ ^7 c
# p; s. V F5 Z
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( U' Y( y+ {4 G
: v& k/ G; U" r- ]8 L7 s/ Q( G! l Minimum = 40ms, Maximum = 51ms, Average = 46ms
" s+ B" R: ^/ X2 J9 J & X/ f" O7 Y6 d
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
' o4 i4 ?* A6 L) v) K) n1 a1 e
- o7 C& L, a" N' i: |4 R0 i -l size Send buffer size.
. ~+ H4 Y( J4 y% c# _. ?
/ v$ Z5 C/ R) u) ~ 定义echo数据包大小。 |
|