Board logo

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

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

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
6 C5 _$ ^$ Z+ g/ Y( A: ^+ I   , M: W% B2 U* A& t* n! X
  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& F. h* e' r9 w) I1 R7 W! w) p& c- L   6 u- u, s$ |9 E2 I4 Z) G6 k
  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
0 n$ o/ }* t- B, i0 l, G# c- O  
$ n8 y* Y( ]5 S( g8 |  Options: ; E, ~) b4 S" ?6 p
   4 r' X: w* e, I& w! z: @% r9 P5 ~
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% G, E4 p8 C# j0 G1 l& f( b   / a2 L  Y3 K" p' u
  不停的ping地方主机,直到你按下Control-C。
% h- L& p  ]1 W4 x& Y  
6 l$ e1 Y% g2 a8 q; B: t! v  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ; ^  O% \: G% ~! U, c& g
   4 T+ p2 ^6 Q: A0 z: ^, T: [! C( s
  -a Resolve addresses to hostnames.
  ]' ?1 C3 a4 {& n7 F9 P; V/ p/ ]# ^   & L+ X0 m2 b" g- Z$ m1 h
  解析计算机NetBios名。 3 R& c, [: ^$ A- ~% m8 K5 j# O# Z9 X- O$ X
  
- e7 v1 Y1 ?  {9 L  示例:C:\>ping -a 192.168.1.21
2 ^, Q* z5 k, I2 s$ s, O  
7 [7 g: K6 Y2 {$ {4 _  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
) C) S2 K/ v9 d  
8 E# J) n+ J0 d$ C/ l# y  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ R" [( |5 y3 }1 Z1 k$ M   ; Z7 K- s. j  V( g
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / P5 ~- Q1 i7 ^0 r* C
   1 e2 ^9 Q5 ~/ s2 L+ q, j* ?% O$ `
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; S% {3 _4 J# c7 A  d) o, x; P8 J2 o5 U9 f
  
: U6 ^' `; V- C/ _. ]* i  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# {% q( y0 w% T8 ~9 u   ; q% O9 c- T8 l/ W# k4 N  e# C
  Ping statistics for 192.168.1.21: ( X. r6 K# r% t3 K* g
  
* E# c* X" M) r  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
- g$ d9 q  D1 a; g2 z3 v  
8 L/ E7 `, X6 A  Minimum = 0ms, Maximum = 0ms, Average = 0ms ) e3 {' v- W; f( E" q8 v" r
   ) w$ i$ u3 i/ Y% ~% M8 I
  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 ' ~7 ~) S' V0 F. Q0 [: l
   7 T0 r9 M+ `# _( e" m) Y
  -n count Number of echo requests to send.
% Q4 N8 b( \% ?7 y   ! i3 J; u: ^. U4 Q5 R$ o( ?& q
  发送count指定的Echo数据包数。 9 `- I/ g/ Z. i/ W9 q
  
2 Q% M$ C' u+ |: J! _  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ) ?8 u: F4 f! ]3 f& w" K
  
0 E) o; f% ]& w' `# a5 h  C:\>ping -n 50 202.103.96.68
- N5 f  C& X- p7 b; q% d# }2 i   3 Q, ~" D: `6 x( v0 ]& j. p
  Pinging 202.103.96.68 with 32 bytes of data: ( s2 P8 |; X9 A& B; C8 l3 S) A
  
& `% d) P0 X2 {  b& K' z  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' K( u: b! ^' a1 s' R8 U   % g* ~3 ~0 z/ j- `" y" a+ B
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( T4 F4 V9 f  _  
! R; }% ]6 o0 ~: w' I  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " s& I7 m' U8 H& Q  I$ K+ G
  
  @. _% j  c6 S: {6 Y  Request timed out.
# N( ?5 y8 N7 H& v2 I  
9 i- Y2 N: r0 o7 h- L9 Q5 u  ………………
# S8 T  F3 c6 W, q  
" s' T8 j3 C) d; e" O1 j+ J' R) N  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 c2 ~- L6 _) r( M4 R: @
  
% S( ]" Y1 b, U8 S- |. [8 [& Y  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 |/ i3 ]3 g- c( {/ k1 T
   " H6 P! s9 J  g" R' V
  Ping statistics for 202.103.96.68: 9 Z7 H7 Q3 E) m0 }( J2 v: B3 H0 O
   1 z2 e+ {2 p# s# m& i+ w
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - r3 r1 D' a: S
  
  ^4 d8 Q- `2 e# ~% n- E  Minimum = 40ms, Maximum = 51ms, Average = 46ms 8 {( M) c7 K3 x3 ^4 G+ ^" N
   % s0 o7 _) n9 f5 C2 ^: U
  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 u+ {9 D8 o0 y, j' W$ K& N   . c) Z; x* U6 B& M& S4 o: x
  -l size Send buffer size.
* a% w$ h& o; a  t# @  
# {( ~9 F! n$ `8 M& R0 z# [  定义echo数据包大小。
作者: 冷雨清心    时间: 2008-9-25 15:54

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




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