  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 $ y \; O: F; F, G9 q7 A( ]
' N3 t, _* d# P
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: & m" X4 D2 r( e9 S
( G" P* @5 Z0 x+ 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
/ ~& _9 z8 p+ Z, L+ ~& M 8 o8 G' c& L$ j: [7 r8 j4 o) d
Options: 2 ^' o; Y7 `( t- [+ A8 {6 S
5 u, [( y3 \6 H8 B& O; G# F -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ q m1 P; n/ M+ q
2 [7 O9 w# w2 E$ _) F- ]0 x1 h 不停的ping地方主机,直到你按下Control-C。 ( E: v/ m* a( w0 g2 U
/ T+ q$ d* T* P$ Y! K. j! t. F
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 e1 O) S U" D2 R
. M' n+ W5 K: F1 u1 M -a Resolve addresses to hostnames.
3 T- I. n# L) Y8 H , C7 {" S a- k
解析计算机NetBios名。 3 G! D9 }8 f( _
" ^5 g' y' v' h: Q s& |' L
示例:C:\>ping -a 192.168.1.21 ; Q5 m. V7 T# t4 R3 v9 `9 A; Q# P, R
8 B0 V- c; f, p S- ]( ?
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
T2 x( f! {% c+ B( J4 E6 |! h
5 a0 }5 B! I3 v# G! W1 y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . t- h$ w# R/ t. Z# _
- D) T% h" A3 k7 T) @+ [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; s0 i/ F7 {6 ] X
. P$ v% _* G" m, J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , t5 I F6 W: c# l8 F7 d
8 i: h9 B* C. n% y' K! p
# S, d2 J1 y: m6 x* V- R0 c. ~* G8 D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , o2 h$ p6 s, f; m6 E
5 ?% B! H1 w0 }3 [
Ping statistics for 192.168.1.21:
* S8 @" J n! {3 i 2 Q9 t4 @: X* S+ y- W( Z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
O* o+ o0 R/ s7 N! S6 m7 T 0 d1 n' ]4 H4 L
Minimum = 0ms, Maximum = 0ms, Average = 0ms
! `1 E. g4 y& B, y4 q4 i2 ` ; ?0 w3 |! n$ [5 j& A# @& E7 q5 E
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
" R4 m1 C2 R# ^) n/ m* a1 F" C+ r' N
6 a9 C. i. }$ Q4 s3 O* q* y$ ]# w -n count Number of echo requests to send.
/ o$ l9 T9 k/ D
, i4 m. @/ \; Q! q 发送count指定的Echo数据包数。
/ Q4 B* m8 P( M. X
( A$ H! W c4 o 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
: |. t) U. p1 @4 W5 x: X/ U 9 w; r- D) A5 X
C:\>ping -n 50 202.103.96.68 # L9 e6 t* d) A" ]5 d9 B2 H; l
+ Y9 o2 ?+ a* C7 s" S8 t
Pinging 202.103.96.68 with 32 bytes of data:
: [. F& }/ C2 G ! S; P7 m8 Q- R# v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, b/ y/ B7 T- o! y& i4 c* ?2 r
0 S9 w( ~7 j- Y2 @- N2 S Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 y/ O. y& [9 ?4 Z9 k6 y1 w0 Z& ^0 x - J; J* D( V, k& b ]% V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , x$ }0 ]9 ?% X \6 i/ s
% U4 Z- N7 U# V/ R4 ^8 F Request timed out. J8 S% S; E$ G) R+ s& k
( h0 G7 k% O% V2 Z5 E ……………… . U% s3 l' U( J- t; t
# c' r1 W! h2 C! b$ B Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 h a. X* u+ F
/ ^% N4 q/ W f8 [- t- u5 \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - F4 `" c k& p s4 C9 B2 R
) p. f$ c% ]9 P" f/ t' H8 X8 [
Ping statistics for 202.103.96.68:
; ^* C& Q# u2 Q# Q, i# r . W' w% }, B4 t w! o
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
" q0 E4 |3 r6 _9 Y 5 N& p2 N) T6 `0 j8 U+ s: [! j9 A
Minimum = 40ms, Maximum = 51ms, Average = 46ms - o0 |. @8 |6 Q
& m- B6 g" [9 D8 c' m; E( i
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
' \0 z: T* @' w2 y$ {, z8 Z " B- z* t2 v7 i( W5 c3 p
-l size Send buffer size.
6 Z c% }: T, @4 j' m/ V# @ 7 B- j# T, n' I
定义echo数据包大小。 |
|