返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
0 H! M4 D% z! y: U  
/ G  K/ [4 l5 r; l6 q4 |0 ~  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: , [% Y: F: L+ b0 n4 O8 @
  
% u+ F2 C* D2 x( C  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
, j9 V/ r4 c( R+ `' |6 Q0 J3 s' J   % B2 k+ T( i8 r* k7 `' T3 l
  Options: , N5 J% ^+ F; x+ T6 C2 D
  
; S9 b! e; h" I" A  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ; d# _/ J2 v; Q7 P- J: e
   - e9 F/ n9 a( {$ E6 U
  不停的ping地方主机,直到你按下Control-C。 . d2 g2 r0 _& h& L! ?8 y) P
     X2 D; d( C# f3 [9 I7 Q3 C
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 3 @6 C: u  A& b: r- i4 m8 r: u
  
5 g0 O# x3 I+ E" J2 N8 d5 O/ _  -a Resolve addresses to hostnames. 0 ?- X5 \2 l* q* B0 |; d
   0 G7 S- a/ }* G' m5 p
  解析计算机NetBios名。 ! A; u( l/ U. ?2 M3 l
   % h2 ^. y1 x) b, S% l  b6 L* r, R
  示例:C:\>ping -a 192.168.1.21 + [' m7 R, @" k& n0 E
   + [- J% d0 b$ m# n- y
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % l& c& K3 l2 ^5 Z- g7 ?
   ( l( `5 i, E  i, C) b2 {3 o
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 g7 A% e* x' g1 ~2 u  
% l# j7 G6 B: i  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; N$ o; ^" z  T
   ; h+ f  J% f; Z3 Q& h/ _
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ) {/ l: T* r* o6 R6 q# C
$ I' j# R+ i* L1 n) r: a4 K% o' P
  
; ^" F; o1 F* h+ K; q  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 X6 B: l9 K/ i, _; S  
( p( f: A4 _, n, q! l! u  Ping statistics for 192.168.1.21: * N: F1 O7 V; X2 N. s
  
1 w1 ~7 c8 m2 [2 o* `  i  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
/ w0 n' {# ^1 `: S  
6 R! R7 U3 y; t7 K* Q- c8 }  Minimum = 0ms, Maximum = 0ms, Average = 0ms
# p5 n* m# v; u% C$ V1 J# B  
7 ^; D% b/ W: O6 I6 i! N' a  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ) k5 g! e* |# p5 v, R, l5 e; S
   / H0 y! H$ s' y- Q1 F
  -n count Number of echo requests to send.
% ?! C( G% q* w3 ?4 M0 d  
- j) f+ {: k/ G  发送count指定的Echo数据包数。
$ y8 F1 g6 r; F" L2 A1 e   $ b& D- C, w: c% N! B, A+ C
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ( u+ Q2 ?  ^  w; ], o' b' K' [
     ^1 `: t. ]1 \, N  e# \- a
  C:\>ping -n 50 202.103.96.68 " r9 D9 K# v; S- Z1 l7 {) _. `
   ) {) n/ C: ]( B6 m6 w$ e& F
  Pinging 202.103.96.68 with 32 bytes of data: ' _. F7 F0 B- }. i
  
/ A# q: X$ j) p  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; r! t: @7 D' q% O7 f3 u  
. f) y# E6 v7 S; Y' X' r  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' m4 U; z# l) O! q
   . u0 q7 s$ F$ W
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' V1 e+ x3 F9 E; ^
   ' f# o7 a0 _9 a) m" D- _0 Y' M
  Request timed out.
1 _$ k, g; M$ s) }   0 I4 A( j! P: I" V& Z' b
  ……………… 8 r  d! ~& p+ p7 z2 z
  
5 P$ g: H/ e) U6 i) D( t- b  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 e7 J" v% X4 q8 [: M
  
$ C8 ?- k" ?2 R8 I: N2 n7 [  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( d& D6 d' P. p1 V8 S% p7 f
  
+ s6 [* T. t5 E) V  Ping statistics for 202.103.96.68: / X! V8 I9 ^$ A) D, h
  
! Y5 \7 W, e+ Q2 |  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
/ l1 y) Y, h1 Z, P% z+ E% J' b  
' h8 R' X! f# A$ T, e  Minimum = 40ms, Maximum = 51ms, Average = 46ms
, O" V$ ]/ P) w/ [& _   2 E7 R' @* H6 ~* P9 z& p) q
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 8 n+ Q7 g+ |% r
  
: \, B, f: T! p  -l size Send buffer size.
0 m4 t1 Z% H. R3 f( V3 `   4 t( B# W  p1 V8 X( n& F/ {
  定义echo数据包大小。
89w.org捌玖网络

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

TOP

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