Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 # M' u! _7 f( ]
  
& z+ ?0 I6 F7 y; k9 D1 C5 d  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
! j, _+ \! u: k9 f  
5 Y/ |6 u  H# u  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 # _: @) J2 X1 @
   ' ?4 C* \- Q9 @- P$ p
  Options: ! o/ G% u! V6 C) z0 E% ^  k
  
8 A8 {. Y0 r* D0 [% z% l  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. : l3 Q, e3 y8 L
   $ a9 _; a  y2 q9 R+ |
  不停的ping地方主机,直到你按下Control-C。 6 ~* x3 ?- c* I/ x9 i4 e
   * g# V' F0 {5 M8 q
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 0 A7 Z3 D6 d/ _8 h
   3 I: W: |" R! K+ a
  -a Resolve addresses to hostnames. 3 U4 |& H3 M5 g) U
   3 _- X) C( @. A) }+ p
  解析计算机NetBios名。
6 r+ V; G8 E% L, g5 J9 s   ; `8 w" T1 F( b& T! B
  示例:C:\>ping -a 192.168.1.21
# |4 i( l' S! E3 @  
+ d) V* g( F9 D6 F& S- e  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: / N8 b9 u+ B1 l# T% D: r4 H
  
: U2 }: x) v: F: J* ~" U8 F2 g% n$ J  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * |# I9 j& J4 `5 T# v
   : X9 ^$ A9 ]3 U: J% J) `
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( b6 R: g9 Z" z, }/ E* o! [  
, B- w+ b+ M" h7 r2 |5 R2 g5 q/ Q, \  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , B- {" v0 y* \) A* Q) L: S! {

  ^7 G2 d! n9 j1 h1 F6 ~( v" B7 V! u   7 }& Z4 F8 A  P
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 t# k" @( U0 d' g" i# `4 c9 z
   3 J' ~# Q# E% ~8 H3 O) _8 ~
  Ping statistics for 192.168.1.21: * o9 j  T% D, L3 a, P
   0 t; [% d2 F3 D# Z5 [' B7 R  r
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
! K0 q" z4 Y2 `7 s   3 Z7 s5 X2 C  @/ b5 C
  Minimum = 0ms, Maximum = 0ms, Average = 0ms
8 G) h$ U0 h  P0 s, B   5 v0 s- O7 B" j2 ~4 l& ?# s
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
8 r' ^1 M+ v2 E" A0 Y$ i5 N   2 ~( ?- Z; \+ B, z0 S  x8 V
  -n count Number of echo requests to send.
) ^* H: I' \6 z2 p6 m0 [7 j; @  
' P# P: r2 J+ E& ]. C1 w' }# Z3 ~  发送count指定的Echo数据包数。 3 l. ?  O* J0 c8 X& b) h
  
4 [; P) ]' F$ o& R  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: + z' _. v3 z# t/ O" X, k6 F! g0 o
   7 p6 _* C! ?3 P( b
  C:\>ping -n 50 202.103.96.68
8 L; @7 a* S7 }7 P, q0 k: J5 d" {   3 }: T# N2 g& k/ t
  Pinging 202.103.96.68 with 32 bytes of data:
7 H# e- C9 l4 I# `6 m  
; d4 e9 X: o* R1 q3 }9 ^0 V  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 }4 ?# [8 ?* b/ B5 m4 V7 r' ^+ t
  
6 p1 V" J3 V2 D' o  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ K4 u$ Y% u- d( O   ' z8 U: D& S0 g% G- a5 M
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & {3 r* [# }9 F$ J0 h2 W
  
1 g! e4 E4 C* t5 i8 `2 |8 g6 x" W  Request timed out. 1 l# F! }6 D5 q/ J* Q
   2 m: M; |- Q6 T$ ]8 q9 X6 j) A
  ………………
. F* m( g+ w: @; L   ! B; e) I5 M5 d
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' m2 c7 u6 F5 Q* Q9 k  
# p* B3 T7 D; l- \, n  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & `1 Y4 I; `3 G# C. [
  
3 N% I: }( q. o9 H$ q  Ping statistics for 202.103.96.68:
0 u1 C( m' `( n$ V& |  u   & d. S/ l$ z7 ?- g6 M3 G/ U
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
0 O: F& A: n& E6 V5 Q. P   - l. B0 i, N* O) B! D* {
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
) |# V$ ^8 i& _. q  K  
5 C8 l7 g7 o0 l  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
( z. E. k& c( C   2 c' O! B# ?! ^% A
  -l size Send buffer size.
" ^8 _9 z1 k0 G   $ ?# ^$ z$ S3 k* W; P
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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