Community discussions

MikroTik App
 
FunkyBunny
newbie
Topic Author
Posts: 30
Joined: Wed Jun 13, 2012 10:33 pm

Routing marks on a WAN that is DHCP

Thu Oct 08, 2015 10:47 pm

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.
 
User avatar
rushlife
Member Candidate
Member Candidate
Posts: 254
Joined: Thu Nov 05, 2015 12:30 pm

Re: Routing marks on a WAN that is DHCP

Thu Oct 13, 2016 6:03 pm

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

Pleease. Help meeee.
 
Sob
Forum Guru
Forum Guru
Posts: 9188
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing marks on a WAN that is DHCP

Fri Oct 14, 2016 5:19 pm

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.
 
sophitus
just joined
Posts: 11
Joined: Sun Jul 23, 2017 10:04 pm

Re: Routing marks on a WAN that is DHCP

Sun Jul 23, 2017 10:12 pm

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?
 
carlosfrosario
just joined
Posts: 7
Joined: Fri Jul 21, 2017 3:03 am

Re: Routing marks on a WAN that is DHCP

Tue Aug 22, 2017 12:45 pm