  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
4 x7 y$ w6 a' D- {3 X + t6 V; ?& p( i' S5 r5 |
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
" d5 Q6 [; v# K: |3 j9 o7 Z/ ] , @* {; B* K5 G$ j) S3 P
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
5 u) `2 w H7 M. ^/ @! Z5 ]
2 ?% \2 H% ` h4 \' q- M; i/ I* H6 | Options:
2 q1 a! g4 c! B) Y9 w
' f) s* i9 f e -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. # z8 q0 L! m8 |; b1 u
1 T: b! V1 F6 i( l) c
不停的ping地方主机,直到你按下Control-C。 8 Q q, N! P* U% Y! Q
/ a" o' r9 T! y* ]# }5 G6 ^ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 $ h) I N2 [: l1 \6 P& x( j! \% F
, C0 `9 s6 l# v( R# q -a Resolve addresses to hostnames. $ M5 L* m5 P K
" C9 O1 W1 w j
解析计算机NetBios名。 7 b) V( {4 L2 N8 ~5 p
+ e1 |: n7 W! ^% J& |# }+ F% c 示例:C:\>ping -a 192.168.1.21
9 N. c0 \3 p2 }$ p% a 5 P* z( t8 p0 ^# y: j4 L9 F! E
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 f1 Z' J# | }; ?- z9 {' x
) a" Q7 d9 x* V! \1 S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 K/ ~9 i' I! g, ^# t9 {/ [- V0 |( h
9 W0 Q U! s4 |6 r( P1 J% | Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 9 ~% l; U9 Q* h2 F. x
# V9 X6 ^$ G: y2 k$ [" { Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ }) t0 S2 s( r' k/ j* h+ _$ G) @- {/ F
! d7 i6 ] I+ Z9 Z5 G+ G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 F4 [$ E" \. T+ |" W
$ O1 E L' M, N, U+ H2 b6 I Ping statistics for 192.168.1.21: 5 R8 _$ }7 I: b! }& B" e. _
( s) A/ M" m- l' c1 G, f" f Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
9 Z$ z! s) Q$ }7 G 1 c3 C, w) u1 L
Minimum = 0ms, Maximum = 0ms, Average = 0ms
( i* `; L2 p ^3 ~! M2 I4 ^: W 7 q6 U A1 z) v" j7 I9 ^
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
[. G( [4 g1 g5 v
( |6 g/ ^9 X! t$ a' S+ z5 A -n count Number of echo requests to send.
# B+ L' [! k, }+ O / h# D- ^* h( [1 L( ^
发送count指定的Echo数据包数。
3 Y0 @6 o1 s! V: c: @2 Y . p w+ k! A6 [7 N
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 9 v7 z: v3 q' m* X% q, U
6 B& N) S% p- _3 B. }8 p; o
C:\>ping -n 50 202.103.96.68 E1 H+ m0 v% f R* C
( b4 U, A6 ~) G4 w: M2 v9 z! y. Z# |
Pinging 202.103.96.68 with 32 bytes of data:
0 o( s5 X1 h1 J$ K) T- U( p9 U
5 _; r! B" w' L. `% [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" ?6 Q' W! P5 z* V ) z$ P1 o. q V& }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ ~- V7 w- I2 L
6 D( x2 E2 p" S/ R' T" r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 Q" M# O* R9 v0 g6 T; Y; i `
9 V2 j+ l* l6 o, W0 o( j9 Y+ S% q Request timed out.
! x* N: _* X! m! n$ v5 O* U s# q5 n 7 H/ T* q# M" J1 @5 y1 P" U/ K
………………
- y5 P' F8 t& y8 d* e 6 x! F! \5 B" u8 r1 \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ! v# b9 `: z& y* O1 B( q' R
6 \2 F* {3 H( V& P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 w. N2 [9 [' H' y+ F 4 b% H9 N3 H8 a* q4 u( ]. w- Y
Ping statistics for 202.103.96.68:
$ `' z8 ]4 B& q' _' f/ Z4 X , P6 S9 Y" C6 d' l }% p% o
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: " Z7 c, g! x/ @
2 X$ p0 B$ t* F6 ]/ e Minimum = 40ms, Maximum = 51ms, Average = 46ms
# Y- o" i" G- Q; ]5 `9 b % u r1 D$ Z7 F# C! X, _0 ^4 o; Q+ Y9 L! [
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 ^% r+ O- Z0 d. A3 f6 h5 X
. z5 d0 |0 ?4 N: Y7 P -l size Send buffer size. ) m9 L- I" P! X# A
s& Q, L2 l7 J9 h" n
定义echo数据包大小。 |
|