返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 8 w/ w& S( g2 l* `* ]9 w
   ; q) M5 _7 v3 J8 M: [; {$ c) `
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
6 d  a, V5 p) ^; F  v  
& l, o( ~6 Z. T  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 ! s% J/ u% f5 L3 \: d
  
3 a3 l; m& J1 }; w  V" t7 @  Options:
  R/ k9 v# P8 Q   . P6 p0 r# E8 A0 a
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
, _( ]4 \4 {, I  
0 Z7 \; _# M, M' E3 [; ~  不停的ping地方主机,直到你按下Control-C。
9 f" t9 |# P/ W" b" K     C% L% C: n2 J( p+ x
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 K- @9 F- O, F3 e. V" a  
( K5 F' ]# v. E4 x' N1 A  -a Resolve addresses to hostnames.
6 e  C: H9 H# f/ o3 x: `   4 c" q. m9 T  H; c5 y7 l4 r- c3 x% ~! k
  解析计算机NetBios名。 * M! S+ f: }( f: C, F
  
3 I: G" H% ]" m8 @! r* o  示例:C:\>ping -a 192.168.1.21
8 S( l  F% I: h( p5 s   , W: Z# y; G( i/ j6 D0 v3 G5 F
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# b2 M- t5 h$ k0 t0 V  
3 S. j) r9 ?+ [; Q5 E  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 j4 g7 ?  L8 S7 A8 w: _3 i3 |& V
   . I; e* \/ ^" k/ h, v
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. h  J' [: `' g2 A  M+ |' @   3 n/ D8 I# V; c! V% I  {6 t& n
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 z) N5 w3 s. p% \* b& [9 f( x, O: \, `

" a- [' ]) b/ e! N  w! b+ \  
) n8 r- c) S4 l. T  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) l" T; ?" E/ S- I: q1 ^2 H& b: w
  
' ], R# S4 u" n0 P& Z) A  Ping statistics for 192.168.1.21: 3 s& \2 D6 G; e- V: X$ D& o
  
# U9 H0 d1 q" J9 M* N6 o. ]: ^  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
6 X9 `+ |2 y' p0 H% F* p1 M1 A( g  
% j4 W! L9 P' B  N( Q  Minimum = 0ms, Maximum = 0ms, Average = 0ms . T8 Z0 `* d% a/ G; D2 A0 ]+ D2 Z+ f
   8 N2 f" e5 f# }+ W' t8 b$ ?
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 : a/ s5 T' Y/ s" K9 R8 _% y6 l7 q
  
- K* D) F# e( J% Y  -n count Number of echo requests to send.
8 Q2 \: a- E! w6 @( K$ b' x; Q   2 `; n+ A* b( u" m
  发送count指定的Echo数据包数。 % g& E, C, L5 i' I' n; [
  
- k, [" X4 o6 N. P  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 D6 [. E) M, b4 s4 i1 i
  
- f8 c7 q4 k$ F  C:\>ping -n 50 202.103.96.68 1 H5 n9 @$ x$ z$ |# l* m: p) [9 E( m
  
! U/ \. P; s$ {+ s/ j  Pinging 202.103.96.68 with 32 bytes of data: ( n4 j, J3 a; V4 `
   5 h8 o7 K2 g2 d- j
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 * C& @# u) {8 v9 V1 ~
   , k7 r, k" [3 X4 t" }( q
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241   D4 y3 N! z( L& l- ~, [2 o
  
* P7 p" n, D1 B! |- K  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 @& j8 G! r* m' b  
# j4 k% l& ^" a8 C; H. a: ^  Request timed out.
# p8 y4 C0 v+ u' k; ?  
. _% K4 J% {2 t4 m! H  ……………… / m+ F! \( |, M$ C
   / o# O" `4 f6 n3 n9 B! u
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 e6 O& U4 @! B; h
   6 S  p8 u5 c+ Q1 ~
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" f4 c; D4 G2 y1 s   7 A8 B* R9 q4 J& W) t- @; L9 N1 H
  Ping statistics for 202.103.96.68:
1 g2 f6 e% _6 g# Z0 b   2 ?" C5 e( I) d* i
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
2 C! |8 w' ^$ {: J' E/ k  
+ e2 O# j- H8 o* Y0 `$ Y  Minimum = 40ms, Maximum = 51ms, Average = 46ms , B# Q! p4 y& Q8 a( ]4 W$ c
  
# ?2 h. t6 G$ `% b& J8 s% x( j, ]  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
8 J3 p* a- J. k   ) d# j) p; _- O6 m# S, T& d! q& j5 S& g
  -l size Send buffer size. , b* O  m0 L6 I: O! w8 Z$ m4 g
  
+ X$ K- M2 H( [2 [- Q0 j; G  定义echo数据包大小。
89w.org捌玖网络

强大,但是我看得不是很懂!

TOP

返回列表
【捌玖网络】已经运行: