What I am trying to achieve in terms of functionality is that
when the primary ISP goes down for any reason, when it comes back up and the gateway is changed, the script will find the new gateway (from status), and implement it such
that the IP recursive routing associated starts working again.
I thought my current script was designed for that purpose but I can disable interface ethe1 and then re-nable it and if the gateway has changed, the primary does not come back up.
Current script, which fails
Note1: comment=BellFibre refers to the comment line for the VLAN interface that data actually travels on vice the ether interface
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
":if (\$bound=1) do={ /ip route set [find commen\
t=\"BellFibre\"] gateway=(\$\"gateway-address\") disabled=no; :log warning\
\_(\"New ISP1 gateway: \".(\$\"gateway-address\")) }"
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alternate Script which seems to address changing the routing. What I think it says is,
get the gateway from dhcp client, then go to the ip route gateway and compare, if not the same then set it to the new gateway.
Note2: comment=bellroute refers to the comment line associated with the Primary Recursive Route
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:local newgw [ip dhcp-client get [find interface="vlanbell"] gateway];
:local routegw [/ip route get [find comment="bellroute"] gateway ];
:if ($newgw != $routegw) do={
/ip route set [find comment="bellroute"] gateway=$newgw;
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If the second one is a better then I need to add the secondary recursive routing too.
Do I do this....
:if ($newgw != $routegw) do={
/ip route set [find comment="recursiveroute1"] gateway=$newgw;
/ip route set [find comment="recursiveroute2"] gateway=$newgw;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Finally what is the purpose of
":if (\$bound=1)
Basically anytime the primary is not available and then becomes available, the router ensures that if a new gateway is in the mix, that the associated routes gets updated.