aieee 发表于 2011-7-27 11:41

ROS 5.2 限速脚本求助!PPPOE 或者 hotspot 按在线用户数量限速!

本帖最后由 aieee 于 2011-7-29 14:50 编辑

以下脚本是ros2.9.6的pppoe脚本!希望ros高手帮我改成ros5.2 可以使用的!
另外我想用hotspot来做!功能和pppoe一样!
当只有一个用户的时候 整个宽带用完!两个用户时平分!
====================================================
#客户数量
:local count1 0
#上传速率,这里是2条ADSL
:local UpRate (1*500000)
#下载速率
:local DownRate (1*6000000)
#平均上传速率
:local UpAverage 25000
#平均下载速率
:local DownAverage 1500000
#得到客户数量
:set count1 [:len ]
#得到平均上传速率
:set UpAverage ($UpRate/$count1)
#得到平均下载速率
:set DownAverage ($DownRate/$count1)
#得到限速值
:local LimitAt (($UpAverage*50/100/1000*1000) . "/" . ($DownAverage*50/100/1000*1000))
#最低上传下载速率
:if ($UpAverage < 25000) do={:set UpAverage 25000}
:if ($DownAverage < 1500000) do={:set DownAverage 1500000}
#得到最大限速
:local MaxLimit ($UpAverage . "/" . $DownAverage)
#突发极限
:local BurstLimit (($UpAverage*150/100/1000*1000) . "/" . ($DownAverage*150/100/1000*1000))
#突发的平均值
:local BurstThr (($UpAverage*60/100/1000*1000) . "/" . ($DownAverage*60/100/1000*1000))
#突发时间
:local BurstTime "3s/10s"
/que sim
set queue=default/default limit-at=$LimitAt max-limit=$MaxLimit burst-limit=$BurstLimit burst-threshold=$BurstThr burst-time=$BurstTime
==================================================================
我自己改好了!不知道为什么,定义变量用全局就可以了!还是就是计数哪里有点不同!
#客户数量
:globalcount 0
#上传速率,这里是2条ADSL
:globalUpRate (1*500000)
#下载速率
:globalDownRate (1*4000000)
#平均上传速率
:globalUpAverage 20000
#平均下载速率
:globalDownAverage 4000000
#得到客户数量
#:set count [:len ]
:set count [:len ]
#得到平均上传速率
:set UpAverage ($UpRate/$count)
#得到平均下载速率
:set DownAverage ($DownRate/$count)
#得到限速值
:globalLimitAt (($UpAverage * 50 / 100 / 1000 * 1000) . "/" . ($DownAverage * 50 / 100 / 1000 * 1000))
#最低上传下载速率
:if ($UpAverage < 50000) do={:set UpAverage 50000}
:if ($DownAverage < 1500000) do={:set DownAverage 1500000}
#得到最大限速
:globalMaxLimit ($UpAverage . "/" . $DownAverage)
#突发极限
:globalBurstLimit (($UpAverage * 150 / 100 / 1000 * 1000) . "/" . ($DownAverage * 150 / 100 / 1000 * 1000))
#突发的平均值
:globalBurstThr (($UpAverage * 60 / 100 / 1000 * 1000) . "/" . ($DownAverage * 60 / 100 / 1000 * 1000))
#突发时间
:globalBurstTime "1s/1s"
/que sim
set queue=default/defaultinterface=all limit-at=$LimitAt max-limit=$MaxLimit burst-limit=$BurstLimit burst-threshold=$BurstThr burst-time=$BurstTime

aieee 发表于 2011-7-28 10:56

晕~没人理我!

zhengwanlu 发表于 2013-3-4 02:36

:for sheng from=1 to=253 do={queue simple add name=("PC" . $sheng) dst-address=0.0.0.0/0max-limit=1000000/1000000 interface=LAN parent=none priority=8 queue=default/default burst-limit=2000000/2000000 burst-threshold=1000000/1000000 burst-time=3s/3s total-queue=default target-address=("10.0.0.". $sheng) disabled=no}
注意更改你的IP和带宽

zhengwanlu 发表于 2013-3-4 02:37

ROS5.x版本使用
页: [1]
查看完整版本: ROS 5.2 限速脚本求助!PPPOE 或者 hotspot 按在线用户数量限速!