Hello,
The basic routing settings are shown in the attached picture. I edited a script to modify the IP Route when the gateway IP obtained by the DHCP-Client changes. In actual use, it is found that even if the conditions are not met, the gateway of the IP Route will still be modified repeatedly. Why? ?
script:”Update gateway”
{
:local newip
:local oldip
:local status
:local x "2"
:for i from=1 to=$x do={
:set status [/ip dhcp-client get [/ip dhcp-client find where interface=("wlan".$i)] status]
:if ($status="bound") do={
:set newip [/ip dhcp-client get [/ip dhcp-client find where interface=("wlan".$i)] gateway]
:set oldip [/ip route get [/ip route find dst-address=0.0.0.0/0 static=yes active=yes distance=1 comment=("tel-".$i)] gateway]
:set oldip [pick $oldip 0 12]}
:if ($newip != $oldip) do={
/ip route set [/ip route find comment=("tel-".$i)] gateway=($newip."%".("wlan".$i))
/ip route set [/ip route find comment=("tel-"."$i$i$i")] gateway=($newip."%".("wlan".$i))}}}
}