|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! b% V. m# k+ I( E8 n
/ ]( W) K! }( k$ z 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 4 d) H( ~% d* F2 ~
/ H* \7 n$ o" D! B: G Y
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 2 d2 i1 ^3 A0 i2 d3 O& G/ A7 b
/ n- W: u; T+ p$ O
Options: Q% N& v& q& C" w) p
1 z4 A$ N. `. E. c0 w -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 W6 l/ g7 G7 N m; Q
; Q# J4 O: ~7 ?3 V F- x" s 不停的ping地方主机,直到你按下Control-C。
2 L6 ^; l; c. i: c) A1 U5 F* ~6 o , z. k7 b B! |1 w
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 9 N" r/ O3 _' K6 g$ v
4 l+ K& _. l, j, P
-a Resolve addresses to hostnames. . X3 j3 o' {3 { k+ _
1 c _5 h' o9 P$ C* ]7 p3 r
解析计算机NetBios名。 3 W @, @- K9 P8 U- P
* i/ D5 D0 Z) X" _% v1 U 示例:C:\>ping -a 192.168.1.21 g9 a8 j/ k2 `# h. |* f" w
# s" X# @0 m# N* N5 Z7 |& Y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 Q% H/ t1 G1 H) K8 a+ T
4 |5 @: P' {1 A0 s; z6 v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ X; ^$ _* d5 a' s' o
2 t5 q7 k7 q4 `7 |+ y Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" d: E2 i! J5 v Z8 ?# E
9 y. O( Q# r' I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* u+ K, B0 L3 F2 J' W" H, Y9 a8 T! v! m/ P: m
5 H" c4 W% ~$ I& Z5 r8 i
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # S( {$ _6 j, X, f3 ?
, ~2 {& A, `, ?* ?, g7 `/ }+ S
Ping statistics for 192.168.1.21:
/ L q$ X6 _) }! A0 I( @
, [+ O8 h4 X, ^- F2 A Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( E/ |) J# J, K" G1 D4 z
6 _0 Q1 l# X i9 i; R) W2 ]6 V0 F
Minimum = 0ms, Maximum = 0ms, Average = 0ms 2 B% v+ L( T4 N' C+ u+ E. k$ `
5 h4 N' Y7 T0 X
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
# ~; v& z I: n" Z
6 Z- o& m1 t7 u& U -n count Number of echo requests to send.
0 u: Q" [9 \8 u6 V: h 8 l' V [3 v3 q
发送count指定的Echo数据包数。 1 C8 w( O& z5 o# F5 y1 ?: n
' b3 d# E! d* p% w* h 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: g# I; l; b8 |0 a/ s
* F/ B9 ?) L5 ]1 r8 T$ M4 U7 |# P. m! ?+ G
C:\>ping -n 50 202.103.96.68 6 `' E: t1 D/ `( l/ `' f
% f& R5 _( m# I3 \% O# o3 e Pinging 202.103.96.68 with 32 bytes of data:
+ c- `' Y2 J5 o1 J6 w" U
! T) t6 P+ w$ x) a# Q) z8 K8 X! o Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 M1 Q- ? t5 `. u( e- C& b
; J4 M; N1 F. v8 s4 v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' ? L0 m: x' V$ N! n4 O
# p; k1 I: z8 U7 z2 i c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ C* t7 }6 W4 {# j+ p+ z
6 i/ B4 N+ p M8 v) H
Request timed out.
* e8 Y' n/ I/ y$ m7 @: J) r s5 K. I3 R. P1 l: U7 s. ^& a
………………
" N1 q: x( Q8 t8 V ' W, ]8 q/ r4 d, ^4 k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 h! X# n: F \( u2 I5 }! i . f* f0 q3 J! n5 F3 T! k. E- V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 L& d( U7 s( \6 F" s$ h
5 U8 ?- I9 }" r" L/ g3 a3 C" Y9 p Ping statistics for 202.103.96.68:
I V5 J+ C; w( S( \' G' Q
2 R) V2 b# J" N) n% p/ Z Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ) W3 Y3 j' S0 H/ `, `* X3 I8 f9 d
8 R5 I2 Y& A! }; w0 P( S# X Minimum = 40ms, Maximum = 51ms, Average = 46ms ( d# Z! @! o8 K+ D
a; A1 [) A6 ~# a8 n% f% v8 g2 v% N 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 o0 Y% V1 T/ Q8 ^! @! p/ X ; {; ~. _8 I! V( h* U, H/ H. y
-l size Send buffer size. - G# E' ?& m( @
, L; w; y2 H/ }7 y a& d! q3 b2 d e
定义echo数据包大小。 |
|