多ADSL负载--掉线后自动修改/nth 请问以下脚是哪位大师所写?
: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 9
: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
}
} 请知道的大师们回复一下。谢谢。
页:
[1]