返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
; i# o9 e( x" ?  [- m& d3 {, ~! v   1 M6 I' ]  @* C' q# _5 p
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
' W* F# {; R1 ?   # o' Q* ^1 C5 S  ?0 J5 A4 Q1 C9 ~
  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
! y7 C9 A5 B4 A4 k6 G# z     _3 J9 b" n$ e8 H3 v1 \2 ~0 U
  Options: , J' D, [3 a( O( m( B! ~8 g& J3 Z
  
# o* }2 [+ ^( b  G/ U) g  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 4 {/ Q' {: q6 ~, @2 x7 d
   & X4 ]$ `) L7 W( t, O7 p
  不停的ping地方主机,直到你按下Control-C。 0 _: F9 d: a( i, ]( {
   % W% z' Z5 S" Z1 E. U6 U+ y
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 @. K5 Y. z6 o7 W  
( k3 a# N5 g5 o7 O1 G  -a Resolve addresses to hostnames. - S$ h! l* L' w6 X3 E" S# }" J
   - h0 c3 d6 E( ^. g' D; E
  解析计算机NetBios名。
5 }6 J6 x, I& V   " h1 v; g. q, n" ^
  示例:C:\>ping -a 192.168.1.21 ) d+ S1 e: I7 C( i
   * ]9 T2 U1 `3 E1 J5 L( U" V
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 4 O& p. `7 L% c  T
   1 N1 V+ M' N# l0 @# V% u
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ! d9 N9 S+ h+ z6 a) X/ ?
  
5 r9 Z9 L8 u+ c# m, V  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # T. L: U. D8 ?/ E% a
  
2 p0 m, t' r% ]  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 |, f; f+ N: b  o( E' z
. K: B( \! q9 g: }   2 t% c, m2 v: y
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 _& \0 J9 p( ]7 l   3 j/ {. E4 m( W& _. l( Z3 U& B/ M
  Ping statistics for 192.168.1.21: , k+ X3 P0 [, m  R  {/ X
   * E4 @0 Y, A" I/ Z
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 8 G, k. n8 D8 R1 a, _  t+ @% A2 b/ Q
  
6 u4 s  L- j: z3 S8 M! o  Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 P: w" ]. |/ @- ~8 ~5 v. s
  
% T& [$ u' {6 Z6 x  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
2 o: `% E3 B* y( ~% N   $ D7 R  F/ s4 g1 R) R. w
  -n count Number of echo requests to send. % N* x9 p% q- a
   - {* k+ x! B0 X, R$ K# v
  发送count指定的Echo数据包数。 $ o1 t/ H  E. L6 g9 r9 P
  
& N; {8 i: U3 A) |  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
  P0 B& C+ O7 J0 a, c+ }  
! Q: n. i: L, \7 I6 T7 h+ V6 b  C:\>ping -n 50 202.103.96.68
( p$ F0 Y5 b7 s  h: R2 ]) n5 v  
' J. N* Q+ G. J' d+ z  Pinging 202.103.96.68 with 32 bytes of data:
( g2 Y  b) k7 `% ^2 n, q3 R  
9 r5 H+ A5 d6 m; N, X- F  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& Y7 Q; \; f! L3 k+ v2 X  
8 v9 c+ ^3 d1 m3 f: W/ s8 y0 q% A  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' h8 a: S, M* K/ {0 i
  
' u3 S, n/ ?, }) l6 j  P4 C- O  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! L' H- H" s0 W$ j  
9 }6 d/ w  w' r  Request timed out. / N' H# }, a" w( Q
   2 X! l* m* h6 ]3 z$ R' D
  ……………… ' k7 H0 r3 R9 d0 c( c
  
& W( ^& R0 U1 _$ y  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% n! r' @6 S& e5 `+ K. q   ' Z2 x5 M$ i. s, \, i. ^- t
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - J5 l+ x0 D  \( T- l
   ' ^( m$ T: `. a0 H  J( O  y
  Ping statistics for 202.103.96.68: 3 {& D& z+ l$ D& W* G
  
2 t0 m' z# F2 U) X  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 J5 Y# m0 n1 `, ?) [# a   5 r, A0 r0 \9 b; ]5 ~
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 R7 p) t& G; D& W, Y! @) M( Z- Z' A   $ a  }) M/ q: N3 v, ^
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ! Q; ^# V( w  [/ w
   ' Z( }4 ?: |" p3 b. f6 e- Z
  -l size Send buffer size. " @) h) ?! F" ^/ f$ J0 p* O
   & O7 O) \5 F+ Q. F7 r. l+ r
  定义echo数据包大小。
89w.org捌玖网络

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

TOP

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