Community discussions

MikroTik App
 
tihovsky
newbie
Topic Author
Posts: 48
Joined: Mon Aug 13, 2012 11:11 pm

Tie route to specific interface

Wed Jan 24, 2024 10:08 pm

We have Mikrotik v.7.11.2 router with two uplink ports eth1 and eth2 and DHCP Client active on each interface, both connected to the same ISP.
ISP DHCP server assigns different IPv4/32 address to each interface, but provides single gateway IPv4 for both interfaces.

Effect is that only one of the interfaces gets actively used (routed through) by Mikrotik, while the other interface remains connected, but not routed through and both routes having the same gateway IP get status of +AS.
Since routing is defined based on the IP, I guess Mikrotik uses whichever interface gets DHCP/gateway issued in order.

Is there any way that I could tie route to a specific interface exclusively?

Note, ISP router is not pingable, but so what I am trying to achive is:
- define one route to ping 1.1.1.1 through eth1 exclusively
- define second route to ping 9.9.9.9 through eth2 exclusively
and then use netwatch through these routes for testing connectivity.
Based on the netwatch results, netwatch scripts could control sending internal subnet 10.1.0.0/16 through eth1
and internal subnet 10.2.0.0/16 through eth2 (if both work) or prioritize differently if only one link is routable through.

So this seems like a typical dual-wan scenario, but having the same ISP gtw confuses matters.
I could make a clumsy addition of two small routers adding additional 192.168.x.x subnets in between which would work and simplify matters, but this would add 2 points of failure, etc.

Thanks!
 
jaclaz
Long time Member
Long time Member
Posts: 667
Joined: Tue Oct 03, 2023 4:21 pm

Re: Tie route to specific interface

Thu Jan 25, 2024 12:03 am

I would suggest you to divide the problem in two parts:
1) Imagine that your two ISP connections never fail and only make a configuration where subnet A goes to ISP1 and subnet B goes to ISP2, this can be done by marking connections through firewall mangle or through routing rules, and a second routing table, if you search you will find existing threads about using the one or the other method.
2) then, only once the above is tested and works, add to the setup the failover method via netwatch

I have very little experience with both mangling and routing rules, from what I know mangling is the traditional way, so there are more related threads and examples whilst routing rules is relatively newer but is (IMHO) simpler and should also cause less CPU usage (though that shouldn't be an issue anyway in your simple setup).

Who is online

Users browsing this forum: No registered users and 3 guests