|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 , o/ d; [7 j! B- v
2 l1 v/ B1 k. B: i* f, m
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # d. `% h0 ~ t* V) C$ S8 D l
: q. j0 O$ }8 m* O- ?
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
/ R: Q: j) o8 ]* E' j+ ~
% A/ Q$ n$ y6 X0 M8 E# Q, ] Options:
6 z0 Z- K/ o) ^2 b% y4 Z. U n- E' k/ ` R3 e
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
1 X* B3 J5 J) [7 P 5 |1 I# ~6 b D+ Z+ f
不停的ping地方主机,直到你按下Control-C。 ' S$ ^* d* R; |6 V* T. V! G3 i
! {4 p' V; }% i! X# E' \( W 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
1 _; h, z: J0 @) a4 } 2 O n# X$ X$ {" Y! |6 P$ o& y
-a Resolve addresses to hostnames.
" W$ {* u( I' i. S" s4 y3 U 2 i. X: ~; x/ D+ x, Q* V! _6 L8 [
解析计算机NetBios名。
6 b/ n3 Q% x/ p% d# s$ S 0 w- m* G6 F T4 o- h0 V
示例:C:\>ping -a 192.168.1.21 . k4 \' Y R1 M0 _" x. f2 [: y
7 y8 Q) x4 d7 n4 Y) @. J
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ r m4 a. ^$ h
) @( |. y$ L7 U( G% E" W& ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 w/ D3 h: h( b) q# J4 | @8 i
3 o8 E2 p9 Y9 {: S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ w% M. M6 Z( ?3 |9 n
1 L5 ~3 e$ t9 B, f! \6 u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % ?, H& o2 _' j' v0 W
1 ?4 H6 t$ d8 L" u8 H
; \7 c" @% r' ]) K& U9 ] Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; C5 A4 b7 u7 H! }" u$ }
( R3 D9 w' W! Y) T Ping statistics for 192.168.1.21: * w6 C" c, z5 U# q# `! p
% ~6 J- ]% o! V$ e Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
# q3 f7 \& D! n . w0 X4 t+ w, V6 R8 ]+ v" y8 ?9 r) R
Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 B; N1 { V- B
- W$ x" x9 j% R8 ?/ d! p9 |( r
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 B7 F, L4 h7 |2 a% a5 k: n ! g/ K2 M/ W+ v; u; D( L
-n count Number of echo requests to send. 8 O8 t( W3 Z' w. R( ?. D. _
$ |7 j9 F- ]' j. m5 a# a/ C T
发送count指定的Echo数据包数。
8 J) q, o o: U: W# e* A: E& f! i! N
) j' G& s6 F$ @9 h( |- Y! j 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 6 M( O/ K( F6 F0 V
2 ^. H+ l: C9 o
C:\>ping -n 50 202.103.96.68 : b# h& {& d/ Q1 j0 c
$ o n# S! |4 k/ R$ L9 I" f
Pinging 202.103.96.68 with 32 bytes of data: 8 v0 d0 ]3 ]1 Y! c
Q( W0 Q, d# r$ u' i' \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " {2 n9 P7 i) ~- E" {3 x3 m0 }
U# u* G* Z( U1 B" a) u+ R Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ S+ n6 s x' _ ) f2 q% V$ p- k( C, H6 P
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; d* P2 t: c. S% W 5 Z t/ T4 x3 I* A9 a2 c. l+ }1 p1 F
Request timed out. 6 m. d$ @( O( @# z+ H8 ~( ~: e7 D# U. v
% Z6 w- @6 }3 k; Q5 F) Z
……………… 1 K* ]% f2 |3 l2 H& j
+ C4 L/ ~% ?. `' Q0 E) S Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 S5 F& `% f; J5 ?/ l7 ~: _
( `* J& y6 T2 T/ b: K8 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! {4 z5 c& N: ]3 |' } 2 q! b+ p& k9 H. J+ F; s* I) x
Ping statistics for 202.103.96.68: 4 m+ L: Y% Z/ Y5 B- {4 N
. x9 Q4 e2 ~& m7 S
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 S5 y( K5 h. Y: o3 X8 m9 H5 W
l+ u, o/ P9 @ Minimum = 40ms, Maximum = 51ms, Average = 46ms : d- g8 C+ p$ h) Z! [2 G3 K, Z
2 |4 u7 l) w; q1 @' J 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 G- s1 f) A# i( R- Z+ P
6 h5 m" V' X6 `, A -l size Send buffer size. % T+ _6 y8 b `2 w' t1 D( } m1 A
2 \ _5 T$ h1 g% X* H- h& T+ ~ 定义echo数据包大小。 |
|