Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
- u- }- t0 ]- H5 A& `. K! n5 C0 e   + M) y" U% {- d' g( M
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: $ `: Y2 U8 ^& Z$ K$ A. N) `4 i
  
' W! i! z  g- v/ _  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
* J4 }* L, q$ L' I- K   : M9 {8 t& t! f+ |3 I4 I
  Options: # \6 h# c& Y, T$ k) {9 q
   7 t; z0 Z% f5 E
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
/ K8 s, N" J3 n( U7 v$ t% d   - {  n8 c: R0 d
  不停的ping地方主机,直到你按下Control-C。
) l/ q) r% L. a$ r7 a0 k   - \; [1 y& o: m* W
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 ^% ~$ s6 K" k2 e
   : j. L4 _8 Y- u4 b) t, l
  -a Resolve addresses to hostnames. % Q# d% K" `$ S7 R: |$ L$ _! I2 A9 |' b
   ) S; u. J# ?1 l3 ^5 M
  解析计算机NetBios名。 ( n* }& l5 L+ @
  
) B) j$ g, t* l  示例:C:\>ping -a 192.168.1.21
, ]" U0 ?  U) x' {0 Q  
! Y, k6 w9 b$ Q, @3 M- T  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , m0 x/ l; n! L6 ^' z2 }2 Z% f
   5 L4 s9 T: D% e2 f* E- J/ ?$ d3 {
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
  M  Y4 P) w/ L4 ^  j8 o, E   6 e& ^' w3 \" _* i- K
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - p+ T$ D$ I+ V% [/ h, G0 G3 }
     q9 t' i' S. ]- d4 \# g
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 @8 x, n/ Y7 J! r; g% `

6 R1 b2 Y$ \. X' r; o5 A4 i; u' x# P. X   4 h. D. F( G7 @7 s5 z
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 u' M7 f; ~4 J. ?! H  c* v8 l2 L  
1 f; u8 Y+ N* Z7 [1 |  Ping statistics for 192.168.1.21: & g" v5 b" {) C& L
   * R; t6 Q: R' a% e& U/ ]- A  I
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 N' y+ e7 I+ J* m   4 x- C  \( E0 @6 Q* l
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
! V, z5 N0 n+ r% q6 Z0 c   4 ~6 Z. e8 q2 H( z( |
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 4 N* E. b# ?( a6 s$ o8 g
   ! w+ d) I3 d; L& E2 n0 P
  -n count Number of echo requests to send. ) V9 f% D. }1 ~9 {0 E2 b) T  d& ~
   # D& ?; o5 S. W/ |0 w' n; C
  发送count指定的Echo数据包数。
# V3 ~% `( S1 H8 y, r$ E! X  
: K- A5 n/ m5 v- j& L* e  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 5 n3 ~& I- k4 _" I9 w$ v
  
1 t# j7 {, c9 [  C:\>ping -n 50 202.103.96.68
0 k* c  ^1 X4 w' [/ V9 l   0 c; Z  |  i* g) k9 S( Z2 @% s
  Pinging 202.103.96.68 with 32 bytes of data: 9 b- l* U$ V* p+ |5 Y; k: V6 O
   6 x! ^* y5 R; _; `6 J
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( I# r& W' M. k9 i0 j' f3 n  g7 K: k   4 y7 w, Y8 M* ?: H5 F' i
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' l) Z5 N- }- F4 h9 Q! v   9 N3 ^6 K2 z' g' J
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: f) I- Y! N- o' }2 Z* `3 m- ^3 g  
8 F7 f  n6 j- ~% \) d# }& |* r  Request timed out.
$ G/ Q* k! x2 N' i6 i   8 R0 I# {, a, W& a1 M+ b4 k
  ……………… ! M" Z+ X% v8 U7 a' w/ V3 y$ e
  
/ H3 M3 s1 T4 Y# K6 b  T4 Z9 l: o, z  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ I  N" G0 {3 z' i: F4 t     N4 b1 ]8 N# i# w) G; i. ~
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 [& ^, k. N3 g5 ^
   ( f& V- \6 `$ e
  Ping statistics for 202.103.96.68: 5 [+ o( e: `0 o2 S
  
8 f4 e  ?1 R7 [$ z  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ E1 _1 U7 N7 m  
, S6 s0 `* {  S1 s  Minimum = 40ms, Maximum = 51ms, Average = 46ms
) H% f% x5 v  c/ G  
, d0 b% `. [6 o6 y  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 5 [: c  B# c. ^0 N& V$ ~& B
  
( T" i  ^! n" k4 o" a, u+ ?  -l size Send buffer size.
+ t, ]8 I: e6 V& x' ?4 c+ k  
" l. i- ^2 J4 p9 Z4 t9 d( V4 |2 `, g5 g  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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