Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 : E  V- f( w+ f+ I' O5 d
  
) D* z# o0 P" c0 n+ _9 I9 b  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 9 l1 {+ @+ b9 K& c+ \9 ^" A5 I8 A6 K
  
' v  N9 z$ s0 K7 ~: x9 J" 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
3 f$ a  e  O0 J4 P4 }. Y0 G. D; H  
9 L( z0 G+ d% a5 S) q. U7 X$ k3 Y  Options:
2 F- K. N% a: E8 r3 I. k  
$ O4 D# p5 ?) y# H% {  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- `8 w" L9 b! {   . R4 s9 s. N. |
  不停的ping地方主机,直到你按下Control-C。 ; f2 g% D, x* ]: H7 n1 S
  
7 |- w) h% Z$ p6 \- K  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 W) ]1 r, K1 w# g/ I: g1 A- ^   ) q2 Y  ]$ M3 N$ N$ K: S6 j2 t
  -a Resolve addresses to hostnames. + D" l3 ^" ]' W( Q) k3 }9 @
  
4 J$ g: j- ^) J) X% @  解析计算机NetBios名。
, a" l& H& f) E+ f& i5 Q   * k1 K* H! n: r
  示例:C:\>ping -a 192.168.1.21
+ ~1 J+ _3 B0 p1 c& @) k3 ~! Q  
$ y8 R  `7 P5 W9 e- D  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
  [( r) |4 Z) D) R0 u( m- X   / x& S7 r- y+ ^) p1 O* O2 W, {
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# d& f" }& u+ b% f/ O; `  n$ D   # b. F0 m- v) }' B; x
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 Y% A: [/ @. _9 ~: r* w) U( B
  
" q6 m6 {  `$ @/ k) R  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 }4 O1 y( }. r, j( s6 d# Q5 n. W
: B, E- l: c/ n- D
   ! o* b( S8 g4 L- c8 t) o
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 j; ]9 ?: o5 G) J7 X. J: d   " S# {9 V$ s$ ^( S5 p8 u
  Ping statistics for 192.168.1.21: 4 l. d8 N* |, S
   * f0 S" C. q8 j
  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
9 K0 j7 }9 Z& ^; _5 ~/ K  
! H  g9 X# A" H3 A' j; J; S  Minimum = 0ms, Maximum = 0ms, Average = 0ms ! u8 `/ F- I. A5 I5 D. `
   3 s6 c1 Y2 Y( f
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ `, N6 I7 l) n! k3 F' x  g  o' N   , P0 ~/ {+ Q* O8 f" ~; _' A
  -n count Number of echo requests to send. % N9 o7 u4 T# ^  ?' b, J
   ' S+ B- f; u! f9 Z
  发送count指定的Echo数据包数。
: x& O3 w) x) H1 A1 C   $ ]1 ]- v8 X3 H) ~% T4 M3 d
  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) F5 ~) W1 k! q   5 I) O/ z2 y* z& h/ C
  C:\>ping -n 50 202.103.96.68
% _& V6 Y/ l4 j1 J   % o7 }  S0 h$ Q. S# U1 s" e
  Pinging 202.103.96.68 with 32 bytes of data: $ S% @! U/ u* {7 ^
  
' {+ |4 g: K7 h5 F, M+ d  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , R$ O* Y+ f. g% {  C( W
  
1 ?1 `% A7 |2 ]* v# g* Z! w# P  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 r' v! }- c3 s1 u   3 g+ K$ H5 D- _* }
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 p7 l% ?! v7 M4 q& O* f3 a
  
9 Q  p& @: ~9 B# S  Request timed out.
# `  ^% Z% o: L/ B$ e  
8 }6 r) x+ D* y+ |2 m  ……………… # X. l' G. y5 K: {! q/ g6 y
   ) U+ X8 |7 P6 _% j* @1 T
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; |. `1 ^( D3 n5 t6 }  n( e% }% b9 ~- p
  
- ^0 J$ m) w# Z1 I* U& q9 A- A2 m  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / k4 `. d9 w0 K. q& K' x
   4 p, k+ z) T( k: d- U7 S: X+ @
  Ping statistics for 202.103.96.68: 7 _6 C  l6 w- x  o( `
  
5 ?0 w& w$ d: ?& e! X3 Y  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: / U' h- v( ?, Q9 H) @
  
( V1 }4 x$ l; ]$ f- `  Minimum = 40ms, Maximum = 51ms, Average = 46ms
3 B2 X& `( [" T5 a* D# A" p: C/ q  
; t6 K: Q' G; i& [* p/ x* Q8 ]  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 6 z+ |: S' ~& O3 S
   / S6 C, z! A3 J8 L( i' |
  -l size Send buffer size.
: R5 q( m* x/ n4 \) \. L   7 Z5 J0 m( B( F4 H% d4 M% g
  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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