Board logo

标题: 教你正确使用Windows的Ping命令 [打印本页]

作者: 野人e族    时间: 2008-1-27 22:16     标题: 教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ! i1 x4 C* U% W1 a% Q5 t- ]
   / T' z# P& W/ _% y- v
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& d4 U' N4 ]$ N: a  
& c0 a1 M( j( R+ 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
' n9 E1 z1 Y3 {; u% _1 W   # v( w5 v5 b* `0 O: `8 t8 M
  Options:
5 H% T$ A7 n0 ]& L8 J7 Y3 P  
, C" k3 L* s, R, h* Z8 {  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
; a0 ?$ U1 s& r) [, r9 v, c   $ v' h" c) x; z) t
  不停的ping地方主机,直到你按下Control-C。 3 B+ M7 S0 ?+ W, Y8 V
  
0 \% z5 \& l6 i8 B  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 V+ b% l7 o" P8 Q) n4 N  K' ~' }
  
6 t& B" J4 R  E) R1 X; N/ x  -a Resolve addresses to hostnames. 3 V- G/ m! O% p2 o* f/ Q$ ]1 q$ {
  
& @4 L  v2 p  u  解析计算机NetBios名。 + y- C+ g$ W% C, u  t9 Y
   ' d4 s/ g1 k$ E4 S- Y* T
  示例:C:\>ping -a 192.168.1.21 3 r. f! y  u3 h7 ?0 b
  
" m# [+ d) o6 c2 e' r  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
' J) |' i) [2 h, U( l   9 N9 v  k/ X! F! B- ?
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' z. V& m! e8 D* S  
' c2 S* [# G8 P* z  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. C. Y# k; w. A1 s% j! K$ |& f1 U   : j/ h* V; j, K& B% ^& K4 F! C: R
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! S; K3 e; e7 b" l( T/ u3 @$ W& F5 [
   - B) @/ p& p* P2 o" L6 _4 D5 ]
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / f9 [# x4 C7 z7 D
  
0 U% y- m/ j) h! ?& q# R! c  Ping statistics for 192.168.1.21: 9 ^1 S7 N3 s. M5 {; l  Q: U
   0 Y  d% j/ d3 U. j" F  d% k" x( ^0 A
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / Z+ ^. d, J/ D
  
2 H* ~- q6 H# `6 O  Minimum = 0ms, Maximum = 0ms, Average = 0ms
# ?# Q( U+ c( w4 I& U, a   $ S$ c( Q5 k0 K( E
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
1 D) W7 d6 H+ }3 z) T  
: _- A( u* W4 ?$ B0 W" o9 S  -n count Number of echo requests to send.
& P/ H8 C. W5 U& `  
+ }! s/ O8 H* m9 n0 a& h  发送count指定的Echo数据包数。
2 {3 g7 ]+ _2 K3 e: ?: {0 b/ X/ k   ( p! A" b% j& w% k) ^
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
& E0 l3 p$ R. P- d- i; I6 ~, |) s3 e   1 R9 N1 d5 `% B$ B$ r
  C:\>ping -n 50 202.103.96.68 8 p6 A- h4 j: f2 v% C5 A6 S
   , M6 P( v: H5 `) Y& \
  Pinging 202.103.96.68 with 32 bytes of data:
0 P+ m7 @) v- u' K6 q   : x3 _& d4 ~, M. A$ J( |3 N3 f% [
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( V" n6 T- ~& ]# w  
% E( \0 y- q. ~( J  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' u: r  K/ D" f8 G/ I
  
7 P  m+ e* g% }2 s3 H7 X  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% h8 M  l: Z& z   ) `3 w, Z) }2 i$ {* o
  Request timed out. * m  l& t" a$ W! X2 c! J
     {2 E$ K# K$ A& e
  ……………… * o6 p5 B6 n( F/ J$ C
  
8 W$ x+ f; z" y0 L  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ J- _# v7 v( z/ W' Z6 {* B; T  
! W2 F1 }$ o7 P  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # c4 q( y7 `1 I+ j1 r3 e
   - i( l! b6 x3 l3 }& y* ^0 Y* _
  Ping statistics for 202.103.96.68:
' n+ x7 n( y  e6 G9 x. R   / e( U; \0 m! Z% N4 h
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: % W$ n. l, H0 r* I  `( Z: ?
  
, u" B+ \, ~! d* g9 q) E8 P  Minimum = 40ms, Maximum = 51ms, Average = 46ms ! N0 k' b9 O0 N* b
  
+ h% x% z* K9 c; k  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 % D/ a, I9 X* x7 h/ z
   & w1 k% l: s: [2 q
  -l size Send buffer size. $ ?. y& d8 v- t' x
   / m4 M5 {( _# q$ U
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2