Community discussions

MikroTik App
 
Przem
just joined
Topic Author
Posts: 2
Joined: Fri Feb 07, 2025 10:15 pm

Can't figure out recursive routing

Fri Feb 07, 2025 10:28 pm

I'm trying to set up a recursive backup on my Chateu. I can't figure it out.
Zrzut ekranu z 2025-02-07 21-17-54.png
The primary internet is provided via mAP Lite which is connected to eth1 (which gets the internet from my phone). Secondary is from the Chateau's LTE modem. The idea is that when I turn on hotspot on my phone the Chateu should use net from mAP lite, otherwise from LTE modem.

Which requires recursive routing due to extra hop on the mAP lite. Without it I need to disconnect / turn off mAP lite to make Chateu switch to LTE.

Currently my routing table looks like this:
Zrzut ekranu z 2025-02-07 21-24-56.png
I've tried tuts and docs and while I get the idea, I can't set it up. This is where I got:
Zrzut ekranu z 2025-02-07 20-40-17.png
Apart from that - why I can't disable those 2 routes from lte and ether1, can only remove them?
You do not have the required permissions to view the files attached to this post.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23315
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Can't figure out recursive routing

Fri Feb 07, 2025 11:22 pm

Please post config
/export file=anynameyouwish ( minus router serial number, any public WANIP information, keys )

In general
Primary WAN distance=1 check-gateway=ping
Secondary WAN distance=2


Recursive
add check-gateway=ping distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1 scope=10 target-scope=12
add distance=1 dst-address=1.1.1.1/32 gateway=ISP1-Gateway-IP scope=10 target-scope=11
add distance=2 gateway=ISP2-Gateway-IP


ensure you dont use 1.1.1.1 as one of your DNS servers.
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1865
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Can't figure out recursive routing

Fri Feb 07, 2025 11:35 pm

It pretty easy to understand using recursive routing in this simple terms:
A → B (A needs to reach B)
B → C (B is reachable via C)
So, A → C (indirectly via B)

Example using recursive routing with ROS:
1. Set A to go via B:
/ip route add dst-address=A gateway=B

2. Resolve B via C:
/ip route add dst-address=B gateway=C

3. Now A reaches C via B automatically.
/ip route print
 
jaclaz
Forum Guru
Forum Guru
Posts: 2593
Joined: Tue Oct 03, 2023 4:21 pm

Re: Can't figure out recursive routing

Sat Feb 08, 2025 12:02 am

If you hover over the data in the column with the little flag It should tell you what the letters mean.
DAC means Dynamic Active Connected, these routes are automatically (dynamically) created the moment an interface has an IP address, and they are only for the network of the interface IP and network mask, these are always Active because they have distance 0.
DAd means Dynamic, Active, dhcp originated, this comes from a DHCP client that you have enabled on an interface, that received It from a DHCP server connected to It, It Is Active because distance Is 1.
AS means Active Static this Is a router you added manually (static) that happens to be Active because It has distance 1 (the default when you add a router without specifying distance).
USHI means Unreachable Static Hardware-offloaded Inactive, the Hardware-offloaded Is meaningless/an artifact, can be ignored, Static means you added It manually, the Inactive means that It should be Active (because It has distance 1) but It isn't because the destination or gateway Is Unreachable.
Dm means Dynamic and m means ? probably It Is a special flag meaning that It comes from the LTE interface, this Is not Active (and printed in blue) because It has a higher distance of 2.

Dynamic routes (all of them) cannot be disabled and DAC ones cannot be deleted and having distance 0 are always on.

Learn here in details how to get and post your configs ( both the Chateau and mAP ones are needed):
viewtopic.php?t=203686#p1051720
 
Przem
just joined
Topic Author
Posts: 2
Joined: Fri Feb 07, 2025 10:15 pm

Re: Can't figure out recursive routing

Thu Feb 13, 2025 9:01 pm

thank you all for replies :) .
Please post config
/export file=anynameyouwish ( minus router serial number, any public WANIP information, keys )
sure, I'll look into this - will take a while to clean it though.

I've reverted back to my previous setup with working non-recurive WAN backup, but will try again in the weekend. This would solve a huge pain with my current learning lab setup.

Just to make sure - can I leave one of the WANs intact, without any mods (other than increasing distance)? I thought about leaving LTE connection, with higher distance, but I'm not sure whether "Add default route" from Interfaces -> LTE -> LTE APNs could interfere in some way or not. I assumed not (as there's distance setting in APNs), but I'm a bit too unexperienced with it - and the GUI doesn't help (lot of things all over the place), while at the same time I'm really too newb to already know all the CLI options (which I hope to learn asap :D ).
 
jaclaz
Forum Guru
Forum Guru
Posts: 2593
Joined: Tue Oct 03, 2023 4:21 pm

Re: Can't figure out recursive routing

Fri Feb 14, 2025 11:09 am

You asked about recursive backup (actually failover).

But there are other ways, I would suggest you to use netwatch instead, see:
viewtopic.php?t=198999
viewtopic.php?t=198999#p1102129
the above is as simple as it can be.