v6 Dhcp Client Script
v6 Dhcp Client Script
------------------------------------------
{
:local rmark "to_wan2"
:local GWay [/ip dhcp-client get [find interface="ether2"] gateway];
:local count [/ip route print count-only where comment="to_wan2"]
:if ($bound=2) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan2 disabled=no distance=2
dst-address=0.0.0.0/0 gateway=($GWay."%ether2")%ether2 pref-src="" routing-
table=ISP2
/ip route add check-gateway=ping comment=to_wan2 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether2")%ether2 pref-src="" routing-
table=main
} else={
:if ($count = 2) do={
:local test [/ip route find where comment="to_wan2"]
:if ([/ip route get $test gateway] != ($GWay."%ether2")) do={
/ip route set $test gateway=($GWay."%ether2")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan2"]
}
}
---------------------------------------
{
:local rmark "to_wan3"
:local GWay [/ip dhcp-client get [find interface="ether3"] gateway];
:local count [/ip route print count-only where comment="to_wan3"]
:if ($bound=3) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan3 disabled=no distance=3
dst-address=0.0.0.0/0 gateway=($GWay."%ether3")%ether3 pref-src="" routing-
table=ISP3
/ip route add check-gateway=ping comment=to_wan3 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether3")%ether3 pref-src="" routing-
table=main
} else={
:if ($count = 3) do={
:local test [/ip route find where comment="to_wan3"]
:if ([/ip route get $test gateway] != ($GWay."%ether3")) do={
/ip route set $test gateway=($GWay."%ether3")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan3"]
}
}
----------------------------------------------
{
:local rmark "to_wan4"
:local GWay [/ip dhcp-client get [find interface="ether4"] gateway];
:local count [/ip route print count-only where comment="to_wan4"]
:if ($bound=4) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan4 disabled=no distance=4
dst-address=0.0.0.0/0 gateway=($GWay."%ether4")%ether4 pref-src="" routing-
table=ISP4
/ip route add check-gateway=ping comment=to_wan4 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether4")%ether4 pref-src="" routing-
table=main
} else={
:if ($count = 4) do={
:local test [/ip route find where comment="to_wan4"]
:if ([/ip route get $test gateway] != ($GWay."%ether4")) do={
/ip route set $test gateway=($GWay."%ether4")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan4"]
}
}
-----------------------------------------------------
{
:local rmark "to_wan5"
:local GWay [/ip dhcp-client get [find interface="ether5"] gateway];
:local count [/ip route print count-only where comment="to_wan5"]
:if ($bound=5) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan5 disabled=no distance=5
dst-address=0.0.0.0/0 gateway=($GWay."%ether5")%ether5 pref-src="" routing-
table=ISP5
/ip route add check-gateway=ping comment=to_wan5 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether5")%ether5 pref-src="" routing-
table=main
} else={
:if ($count = 5) do={
:local test [/ip route find where comment="to_wan5"]
:if ([/ip route get $test gateway] != ($GWay."%ether5")) do={
/ip route set $test gateway=($GWay."%ether5")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan5"]
}
}