那们大侠帮忙看一下这个脚本:希望帮忙改成3.30用
:global NewIP:global OldIP
:global Count
:global IsRun
:global Runid
:global Icount
:global Mainid
:global Mainip
:global Status
:global MainKey
:global MainCache
:global RuningCount
:global NewNthCache
:global OldNthCache
:set Count 7
:set Icount 0
:set Runid(a,a)
:set MainKey false
:set RuningCount 0
:set Mainip gateway]
:set Mainid comment]
:for i from=1 to=$Countdo={
:set Status running]
:set IsRun disabled]
:if ($Status=true) do={
:set RuningCount ($RuningCount + 1)
:set Runid ($Runid . $i)
:set NewIP address]
:set NewIP [:pick $NewIP 0 [:find $NewIP "/"]]
:set OldIP address]
:set OldIP [:pick $OldIP 0 [:find $OldIP "/"]]
:if ($NewIP != $OldIP) do={
/ip add set address=$NewIP network=$NewIP broadcast=$NewIP
/ip rou set gateway=$NewIP
/ip fir nat set to-addresses=$NewIP
}
:if ($IsRun = true) do={
/ip fir man set disabled=no
/ip fir man set disabled=no
/ip fir nat set disabled=no
/ip rou set disabled=no
:log info ( "第<" . $i . ">号网络线路故障恢复,分流开启!" . . " " . . "检测")
}
} else={
:if ($IsRun != true) do={
/ip fir man set disabled=yes
/ip fir man set nth=0,0,0
/ip fir man set disabled=yes
/ip fir nat set disabled=yes
/ip rou set disabled=yes
:log info ( "第<" . $i . ">号网络线路出现故障,分流关闭!" . . " " . . "检测")
}
}
}
:set RuningCount ($RuningCount - 1)
:foreach i in=$Runid do={
:if ($i != a) do={
:set OldNthCache nth]
:set NewNthCache ($RuningCount . , . 1 . , . $Icount)
:if ($OldNthCache != $NewNthCache) do={
/ip fir man set nth=$NewNthCache
:log info ( "第<" . $i . ">号网络线路修改分流设置成功!" . . " " . . "检测")
}
:set Icount ($Icount + 1)
}
:if ($Mainid != $i) do={
:if ($MainKey != true) do={
:set MainKey false
}
} else={
:set MainKey true
}
}
:if ($MainKey != true) do={
:set MainCache [:pick $Runid 2 3]
:set NewIP address]
:set NewIP [:pick $NewIP 0 [:find $NewIP "/"]]
:if ($Mainip != $NewIP) do={
:log info ( "默认网关检测失败,默认网关转换成<" . $MainCache . ">号线路" . . " " . . "检测")
/ip rou set comment = $MainCache
/ip rou set gateway=$NewIP
}
} else={
:set NewIP address]
:set NewIP [:pick $NewIP 0 [:find $NewIP "/"]]
:if ($Mainip != $NewIP) do={
/ip rou set comment = $Mainid
/ip rou set gateway=$NewIP
}
} 我用在ros2.9.27里机可以自动更新网关与nth取值。非常好用。希望坛主帮忙改成3.30能用。谢谢。 呵呵累不累啊 呵呵 不会吧
最近在搞3.30 有没有办法帮帮忙看看脚本 上面的用2.9.27断线自动分流更新,用在3.30不行。帮忙改一下。谢谢 又是个折腾CPU的。
页:
[1]