用易-小卢 发表于 2016-12-10 18:15:22

ROS 自动修改PCC脚本


{
:local pppoeclientAllNum
:local pppoeclientRunNum
:local pppoeclientName
:local z 0

:set pppoeclientAllNum [:len ]
:log info ("pppoeclientAllNum".$pppoeclientAllNum)
:set pppoeclientRunNum [:len ]
:log info ("pppoeclientRunNum".$pppoeclientRunNum)
:if ($pppoeclientRunNum < $pppoeclientAllNum) do={
:for ii from=0 to=($pppoeclientAllNum-1) do={
   :log info $ii


   :if ($ii<=($pppoeclientRunNum-1)) do={
    /ip firewall mangle set per-connection-classifier=("both-addresses:".$pppoeclientRunNum."/".$ii) comment=("PCC" . $pppoeclientRunNum . "-" . $ii) disable=no
    /ip firewall mangle set new-connection-mark ]] disable=no
    :log warning ("both-addresses:".$pppoeclientRunNum."/".$ii)
   } else={
    /ip firewall mangle set disable=yes
    /ip firewall mangle set new-connection-mark ]] disable=yes
    :log warning ("both-addresses:".$pppoeclientAllNum."/".$ii."disable")
   }
}
}
:if ($pppoeclientRunNum = $pppoeclientAllNum) do={
:set z [:len ]
:log info $z
:if ($z>0) do={
   :for ii from=0 to=($pppoeclientRunNum-1) do={
    /ip firewall mangle set per-connection-classifier=("both-addresses:".$pppoeclientRunNum."/".$ii) comment=("PCC" . $pppoeclientRunNum . "-" . $ii) disable=no
    /ip firewall mangle set new-connection-mark ]] disable=no
    :log warning ("both-addresses:".$pppoeclientRunNum."/".$ii)
   }
}
}
}

sealin 发表于 2016-12-12 11:54:23

:set pppoeclientAllNum [:len ]这个挺好

zh1000000 发表于 2016-12-22 06:57:01

楼主这个不用设置线路数量,自动识别,挺好的。我想问问,我用电信+联通两组PCC,比如电信是用PPPOE123,联通是456。怎么改这个脚本只监测456呢?不知道写脚本,也不懂脚本具体意思。还望前辈指点。

seignior 发表于 2016-12-23 00:32:38

看在终于发了篇有点价值的东西份上,在你那里买了两台952(EDC可是给俺97折的呢),有啥赠品记得塞进去哦

seignior 发表于 2016-12-23 20:47:02

本帖最后由 seignior 于 2016-12-23 20:49 编辑

好小气......东西还没到手就发个短信说啥"mikrotik和ubnt设备属贵重物品,我司所售设备无硬件问题均不能退换货"
页: [1]
查看完整版本: ROS 自动修改PCC脚本