Routing marks on a WAN that is DHCP

Is there any way to create a static route on a WAN that gets it’s IP via DHCP?

I need to load balance between two WANs that are DHCP, but I can’t create a static route with a routing mark because you cannot use the interface as a gateway like you can with a pppoe-client. The only way I can create a working route is to use the IP of the gateway which is unknown (and changing) until it connects. How can I get around this?


EDIT:

I’ll add that I’ve tried using /routing filter to create a filter on dynamic-in that adds a routing mark. This APPEARS to fit the bill at first, but the issue is because it takes the route and changes the original, if I do this for both routes, the router sort of has a bit of a shit fit saying that it cannot find a route to any host (as there is no default route on the main routing table). This is even if I add mangle rules to take traffic from the router and force it out a routing mark. What would work is if i could do this, but rather than modifying the original, it created a new one, but there appears to be no way to do this. So basically, this way seems to be a complete no go.

Hi. Found someone solution for this case ?
I need routing marks on routes from DHCP server smi :frowning:

Pleease. Help meeee.

When you set routing marks, e.g.:

/ip dhcp-client
add default-route-distance=11 interface=wan1
add default-route-distance=12 interface=wan2
/routing filter
add chain=dynamic-in distance=11 set-distance=1 set-routing-mark=isp1
add chain=dynamic-in distance=12 set-distance=1 set-routing-mark=isp2

Don’t you just need some routing rules? I did only quick test with CHR behaving as simple host and this works fine to give it internet access:

/ip route rule
add action=lookup-only-in-table dst-address=192.168.0.0/16 table=main comment=LAN
add action=lookup table=isp1

I’m not sure if you’d also need to add explicit rules for isp1 and isp2 tables and right now I’m lazy to test it. But otherwise it looks like the right way to go.

This setup works for me to achieve load balancing. How can I additionally have failover? I cannot duplicate dynamic gateway entries provided by dhcp-clients on wan interfaces with different distances, can I?

https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Client
under Lease script example