Please add a routing-table for dhcp-client, so that default-route would go to defined routing-table instead of default “main”. Something like that should also be available for pppoe-client, pptp-client, etc.
Right now it can be achieved using scheduler but it’s not a very clean way…
Sure you can. That’s not a very clean way of doing things, though. You’re constantly using some (little, but some) resources checking the conditions of the while loop and running whatever if statement you have in it checking if DHCP conditions changed.
:if ([:len [ip dhcp-client get backbone.local gateway]]!=0) do={ :if ([:len [/ ip route find routing-mark=local]]=0) do={ / ip route remove [find routing-mark=local]; / ip route add gateway=[/ ip dhcp-client get backbone.local gateway] routing-mark=local check-gateway=ping; }; } else={ / ip route { remove [find routing-mark=local] }; }
That script is run by scheduler every 10s. One can ask why I don’t check “gateway”? Because there is a bug with routing-test that returns: “192.168.20.1 reachable backbone.local” instead of “192.168.20.1”. For now it works, but it would be better to have a native property…