Does anyone know how to make a marked route if you have a dynamic IP on one of your WAN interfaces?
It’s easy if the IP is static as the gateway isn’t likely to change but in the case of the Interface IP being assigned by DHCP it’s quite possible to pickup an IP from a completely different range on re-connection to the ISP.
I know the DHCP client can add a default route, even with a user defined distance but how then to automatically copy the gateway obtained from the DHCP client into a marked route.
Edit:
It might just be easier to make the dynamic ISP the default route and then use route marking to point stuff to the static Line as I know the gateway on the static line isn’t likely to change.
Are you using routing marks? Depending on the exact setup you may get the effect that you want by placing the interface that is using the DHCP client in a VRF (IP/Routes) which uses the same routing mark as the traffic intended for that outbound interface. If the DHCP client is set to create a default route then the default route will appear in the routing table with the routing mark by virtue of the interface being allocated to the relevant VRF.
Do be aware that there are many routeros features which do not really support VRFs so if something else breaks…
Hope that helps.
In the end I just switched things around so the DSL line with the dynamic IP was the default route and then used PBR to route stuff I didn’t want hitting that line to my other DSL line (which has a static IP)