Code: Select all
:local wan1Gateway6 "ip1"
:local wan1Gateway4 "ip2"
:local wan2Gateway6 "ip3"
:local wan2Gateway4 "ip4
:local wan1Gateway "sfp-sfpplus1"
:local wan2Gateway "sfp-sfpplus2"
:local wan1Up [/ping $wan1Gateway4 count=2]
:local wan2Up [/ping $wan2Gateway4 count=2]
:if ($wan1Up = 0) do={
/ip route set [find gateway=sfp-sfpplus1] disabled=yes
/routing bgp peer set [find remote-address=$wan1Gateway4] disabled=yes
/routing bgp peer set [find remote-address=$wan1Gateway6] disabled=yes
}
:if ($wan2Up = 0) do={
/ip route set [find gateway=sfp-sfpplus2] disabled=yes
/routing bgp peer set [find remote-address=$wan2Gateway4] disabled=yes
/routing bgp peer set [find remote-address=$wan2Gateway6] disabled=yes
}
:if ($wan1Up > 0) do={
/ip route set [find gateway=sfp-sfpplus1] disabled=no
/routing bgp peer set [find remote-address=$wan1Gateway4] disabled=no
/routing bgp peer set [find remote-address=$wan1Gateway6] disabled=no
}
:if ($wan2Up > 0) do={
/ip route set [find gateway=sfp-sfpplus2] disabled=no
/routing bgp peer set [find remote-address=$wan2Gateway4] disabled=no
/routing bgp peer set [find remote-address=$wan2Gateway6] disabled=no
}