找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3615|回复: 3

[负载平衡] 官方 NTH 参数部分 翻译

[复制链接]
发表于 2007-5-14 20:20:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
原文内容:
example: nth=Every,Counter,Packet nth=2,3,0. 2,3,1 2,3,2

divide all packets into groups of three (2+1). The packets will be numbered from 0 to 2. So, a sequence of packets the rule matches looks like: (0 1 2)(0 1 2)(0 1 2)(0 1 2)(0 1 2)...

the first rule will match the first packet in each group ("Packet"=0). The second rule will match the second packet in each group ("Packet"=1) and so on. Each successful match increments the counter. When a value of "Every" is reached, the counter is reset to 0. For this to work, the "Counter" should be the same for all rules (you can pick any value from 0 to 15, IIRC).

翻译内容
   例如:NTH=every (计数组),counter(计数器),packet(数据包) NTH=2,3,0; 2,3,1; 2,3,2
      把所有为数据包定义为三组(2+1)。所有的数据包将被标上从0到2的数字标记。这样一来,被规则匹配过的数据包的顺序看起来就像(0 1 2)(0 1 2)(0 1 2)(0 1 2)(0 1 2)。。。。这个样子一样。
{ 注:上面的这个讲解的只是NTH=2,3,0这个规则。包都是被标记上了从0到2的数字。(0包 1包 2包)由于every设定的值为2.也就是三次,所以计数器重新开始计数[原因在下面],整体看起来的话就是 (0包 1包 2包)(0包 1包 2包)(0包 1包 2包)(0包 1包 2包)...}
      第一个规则将把第一个包匹配到每一个("packet"=0)这样的组里。第二个规则将把第二个包匹配到(packet=1)这样的组里,后面的包的匹配规则跟这两个类似。每次成功的匹配都将被增加到计数器里。
      当设定的“every”的次数被执行完毕时,计数器被重置为0。计数器的数值在所有的规则里必须保持一致才能正常的运行.(计数器的数值可以是"0-15"中的任何一个数值)


原文内容:

nth (integer,integer: 0..15,integer{0,1}) - match a particular Nth packet received by the rule. One of 16 available counters can be used to count packets
Every - match every Every+1th packet. For example, if Every=1 then the rule matches every 2nd packet
Counter - specifies which counter to use. A counter increments each time the rule containing nth match matches
Packet - match on the given packet number. The value by obvious reasons must be between 0 and Every. If this option is used for a given counter, then there must be at least Every+1 rules with this option, covering all values between 0 and Every inclusively.

翻译内容

NTH(Every:取值范围{整数:无要求,只要是整数就行},Counter:取值范围{整数:0-15中的任意一个数,共16个},Packet:取值范围{整数:0或者1,共2个})--作用:把规则收到的第N个包匹配为一个特殊的包。16个计数器中的任何一个都可以用来统计数据包。
Every  匹配每一个第“Every+1”个通过的数据包。例如:如果Every的值为1,那么匹配的将是每一个“第二个”通的数据包。
Counter  指定你要用的计数器。规则每次统计次数的增量等于NTH匹配次数的值(意思是它每次归0重新计数的同期跟Every设定的值相等,不明白的话看上面的翻译的最后一句)
Packet  用数字标记已经统计过的数据包。很明显这个参数的取值是介于0和“Every的值”之间的一个整数。 If this option is used for a given counter, then there must be at least Every+1 rules with this option, covering all values between 0 and Every inclusively(这句话我实在是翻译不好。个人理解的是如果它被用到规则里去的话,那么应用它的规则的总数必须是"every+1",是从0开始计算到“Every的值”)

个人翻译,很可能不对,还请大家都来帮忙把NTH的参数设置规则详细分析一下

[ 本帖最后由 guaidetian 于 2007-5-14 20:23 编辑 ]
routeros
发表于 2007-5-14 20:44:12 | 显示全部楼层
花了不少功夫啊,呵呵,值得学习。
routeros
回复

使用道具 举报

发表于 2007-5-14 21:24:50 | 显示全部楼层
虽然感觉这样的解释还不够清楚,但毕竟是一直关心的问题~还是支持一下~记得当时提出来的时候都没人响应,过了一个多礼拜才开始讨论~继续研究中.....看看这个功能究竟能带来什么~~
routeros
回复

使用道具 举报

 楼主| 发表于 2007-5-15 09:43:11 | 显示全部楼层
The "every" option in a load balancing example would depict the number of gateways for a network that you would like to use.

The "packet" option will choose which packet to mark and in a simple loadbalancing setup will mark 1 pkt/gw thus the "packet" option will also be equal to the number of gw's starting from 0 and ending on the number equal to the amount of gw's.

The "counter" is just a counter. nothing more. it should be the same for all rules targeting the same flow.

这个理解了就明白NTH的参数设置了.
要注意的就是计算机里很多都是从0开始计数的.
例如
两个不是1和2而是0和1


[ 本帖最后由 guaidetian 于 2007-5-15 09:44 编辑 ]
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-9 23:41 , Processed in 0.086471 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表