|
很多朋友提出了这个问题,假如有4条ADSL跑PCC负载,掉了其中一条后网络就会出现问题,网页打不开或者很慢等等,这是由于PCC参数不匹配造成的。针对这样的情况WGHBOY兄已经发过一脚本,今天应一个朋友的需要测试后发现该脚本判断不太准确,呵呵。遂花了点时间重新编写达到所要目的。
以4线为例,其中某条线路断了后,会自动判断剩余可用的线路数量然后修改PCC规则的参数,线路恢复正常后会自动把参数修改回正常状态,注意连接标记名称一定要以纯数字“1、2、3、4…”来命名。一般该脚本设置30秒间隔就比较合适。
- PCC:
-
- {
- :local status
- :local i "5"
- :local x "0"
- :local y "0"
- :local z "0"
- :set x [:len [/interface pppoe-client find running=yes]]
- :if ($x<$i) do={
- :for ii from=1 to=$i do={
- :set status [/interface get [find name=("pppoe-out".$ii)] running]
- :if ($status=true) do={
- /ip fir man set [find new-connection-mark=$ii] per-connection-classifier=("both-addresses:".$x."/".$y) disable=no;:set y ($y+1)} else={
- /ip fir man set [find new-connection-mark=$ii] disable=yes}}}
- :if ($x=$i) do={
- :set z [:len [/ip fir man find action="mark-connection" disabled=yes chain=prerouting]]
- :if ($z>0) do={
- :for ii from=1 to=$i do={
- /ip fi man set [find new-connection-mark=$ii] per-connection-classifier=("both-addresses:".$x."/".$y) disable=no;:set y ($y+1)}}}}
-
- NTH:
-
- {
- :local status
- :local i "5"
- :local x "0"
- :local y "1"
- :local z "0"
- :set x [:len [/interface pppoe-client find running=yes]]
- :if ($x<$i) do={
- :for ii from=1 to=$i do={
- :set status [/interface get [find name=("pppoe-out".$ii)] running]
- :if ($status=true) do={
- /ip fir man set [find new-connection-mark=$ii] nth=($x.",".$y) disable=no;:set y ($y+1)} else={
- /ip fir man set [find new-connection-mark=$ii] disable=yes}}}
- :if ($x=$i) do={
- :set z [:len [/ip fir man find action="mark-connection" disabled=yes chain=prerouting]]
- :if ($z>0) do={
- :for ii from=1 to=$i do={
- /ip fi man set [find new-connection-mark=$ii] nth=($x.",".$y) disable=no;:set y ($y+1)}}}}
复制代码 |
绿茶, 网吧, 3389, 服务器, 3389, 3389, 3389, ndeer, 极速版, 诺德尔, 3389, VGA, 服务器, 3389, 3389, 3389, DNF, 锐起, 3389, 网吧, 网吧系统, 3389, 服务器, 网吧, 网管, 网维大师, 3389, 系统封装,
|