Community discussions

MikroTik App
 
Guscht
Member Candidate
Member Candidate
Topic Author
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Recursive Routes

Sat Mar 06, 2021 11:22 am

Hi,

is this the "normal behaviour" of V7 regarding recursive routes?
Like described in the popular thread "Advanced Routing Failover without Scripting": viewtopic.php?f=23&t=157048

With V6 everything works:
v6.jpg

With V7 there is no "recursive" routing?! All I see is in red "invalid" or "unreachable":
v7.jpg
You do not have the required permissions to view the files attached to this post.
 
wizkid77
just joined
Posts: 3
Joined: Sun Apr 22, 2018 9:00 am

Re: Recursive Routes

Thu Oct 28, 2021 9:03 pm

I am having the same issues. It seems like it's not been implemented as yet. My CCR2004 only supports 7 sigh.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Recursive Routes

Thu Oct 28, 2021 11:52 pm

The target scope must be larger than the scope of the route over which you want to resolve the gateway. Set at least to 11
 
mducharme
Trainer
Trainer
Posts: 1777
Joined: Tue Jul 19, 2016 6:45 pm
Location: Vancouver, BC, Canada

Re: Recursive Routes

Fri Oct 29, 2021 7:53 pm

The target scope must be larger than the scope of the route over which you want to resolve the gateway. Set at least to 11
Why was this changed from a less-than-or-equal-to (in RouterOS v6) to a less-than (in v7)? In v6 the target scope must be at least the size of the scope, so 10 would work. Was there a reason for this change?

To me the RouterOS v6 way of doing it makes more sense - target-scope can be easily explained as the scope you are targeting, so if you want to capture routes that are scope 10 you use target-scope 10.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Recursive Routes

Fri Oct 29, 2021 8:01 pm

You could get resolve loop if you put the target in the same scope where you are resolving.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Recursive Routes

Fri Nov 19, 2021 11:00 am

The target scope must be larger than the scope of the route over which you want to resolve the gateway. Set at least to 11
From what I can see, target-scope of recursive route must be greater than target-scope of resolving route. Because:
1) it still works for connected routes (target-scope of static routes is 10 while connected routes have scope set to 10 - that's equal, definitely not larger);
2) it works in the following case:
dst:host, gw:connected_gateway, scope=11, target-scope=10
dst:subnet, gw:host, scope=30, target-scope=11
Here, the target-scope of the second route (11) is not larger than the scope of the route over which it's resolved (11 also). But if you change target-scope of the first route to 11 - the second route stops being resolved (as its target-scope is now not greater than target-scope of the first route)
 
Guscht
Member Candidate
Member Candidate
Topic Author
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Re: Recursive Routes

Thu Dec 02, 2021 11:56 pm

I cant express my feelings how much I hate Mikrotik for doing such stuff, which makes everything so overly complicated!!
For everyone who wants/needs to cheat, this works:

Single WAN-Check:
single-check.jpg

Multiple WAN-Check:
multiple-check.jpg

Still missing a notification "recursive via..."...
You do not have the required permissions to view the files attached to this post.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Recursive Routes

Fri Dec 03, 2021 3:10 pm

To simplify a bit, you can set scope=10 everywhere :)
 
Guscht
Member Candidate
Member Candidate
Topic Author
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Re: Recursive Routes

Fri Dec 03, 2021 11:21 pm

Could you explain the "logic" behind? Why do I have to enter a Target Scope of 12?
As far as I understand it goes this way (from top to down):

Dst.Address: 0.0.0.0/0 -> GTWY: 10.0.0.1 -> Target-Scope: 12
Dst.Address: 10.0.0.1 -> GTWY: 8.8.8.8 -> Target-Scope: 11 [at this point happens the magic aka gateway check]
Dst.Address: 8.8.8.8 -> GTWY: 10.88.20.2 -> Target-Scope: 10
Dst.Address: 10.88.20.2 -> GTWY: ether1 -> Target-Scope: nothing

Why do I need a Target-Scope of 12 for the first route, when the second/all other have a scope of 10?!
Why is 11 not enough but its enough for the second route? I mean 11 is even less than 10 ("not less or equal")?


Can anyone explan this:
Screenshot 2021-12-03 223406.jpg

Why has the Scope here other values as in the Routes page?
Target-Scope of 5? I cant see anything on the Routes page?
Why is ether1 listed two times?
What is "weight" and why is there a line with a "2"?
Why is the "Gateway State" unreachable? The Gateway(s) are reachable?!
What is Flap Count and that MPLS-stuff? I dont even use MPLS...

Why do they make ROSv7 so complicated and cluttered with useless stuff :/
If THIS is the way they design ROS7 - thats catastrophic - there is no logic, no sense, no documentation, nothing.
You do not have the required permissions to view the files attached to this post.
 
User avatar
spippan
Member
Member
Posts: 333
Joined: Wed Nov 12, 2014 1:00 pm
Location: Austria

Re: Recursive Routes

Sun Dec 05, 2021 12:55 am

"catastrophic" and "no logic" only because you do not share the same logic as an equipment manufacturer for ISPs etc. ?
come on ... a little over-dramatic, init?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Recursive Routes

Sun Dec 05, 2021 3:32 pm

Why do I need a Target-Scope of 12 for the first route, when the second/all other have a scope of 10?!
Why is 11 not enough but its enough for the second route? I mean 11 is even less than 10 ("not less or equal")?
Have you read my post right above yours? viewtopic.php?p=891975#p891975
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18959
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Recursive Routes

Thu Apr 14, 2022 11:36 pm

The target scope must be larger than the scope of the route over which you want to resolve the gateway. Set at least to 11
From what I can see, target-scope of recursive route must be greater than target-scope of resolving route. Because:
1) it still works for connected routes (target-scope of static routes is 10 while connected routes have scope set to 10 - that's equal, definitely not larger);
2) it works in the following case:
dst:host, gw:connected_gateway, scope=11, target-scope=10
dst:subnet, gw:host, scope=30, target-scope=11
Here, the target-scope of the second route (11) is not larger than the scope of the route over which it's resolved (11 also). But if you change target-scope of the first route to 11 - the second route stops being resolved (as its target-scope is now not greater than target-scope of the first route)
................................

Chupaka, I believe what you meant to say is that the TARGET SCOPE of the resolving route must be one greater than the SCOPE of the recursive route.
Or put in clearer terms the TARGET SCOPE of the of the route VIA an external entity (DNS server) must be one greater than the SCOPE of the route TO the external entity.
Or put in clearer terms the TARGET SCOPE of the indirect route, must be one greater than the SCOPE of the direct route.
Recursive=Direct To DNS thru ISP gateway --> Scope
Resolving=Indirect VIA DNS gateway --> Target Scope
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Has anyone checked the scope target scope rules since 7.2?? They may have changed.
Is it still one greater, one or more greater, or equal or greater........... can never keep track......
At last check
I thought it was
recursive route(direct) TO the DNS IP, Scope=X and and resolving route (indirect via DNS IP) Target Scope=X+1

Where DNS IP could be 1.1.1.1 or 8.8.8.8 etc ( a known working internet IP )
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Recursive Routes

Fri Apr 15, 2022 1:51 pm

Chupaka, I believe what you meant to say is that the TARGET SCOPE of the resolving route must be one greater than the SCOPE of the recursive route.
Absolutely no.

Target Scope must be greater or equal to Scope, as it has always been.

Target Scope should decrease on each step of recursion (new in RouterOS v7)
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18959
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Recursive Routes

Fri Apr 15, 2022 2:45 pm

Thanks chupaka, I think I have it.

(1) In general, target scope should always be equal or greater than scope. (valid for all routes when viewed as individual entities)
(2) For recursive route processes the Resolving Route (Direct --> internal or closest to the router) will have Target Scope X.
(3) For each success Recursive Route (Indirect --> external to the router) further next hop look, the route will have Target Scope X+1

Thus a very basic Recursive Dual WAN failover would look like thus.....
/ip route
add check-gateway=ping distance=3 dst-address=0.0.0.0/0 gateway=1.0.0.1 scope=10 target-scope=12
add distance=3 dst-address=1.0.0.1/32 gateway=Primary-gatewayIP scope=10 target-scope=11
add comment=SecondaryISP distance=10 dst-address=0.0.0.0/0 gateway=Secondary-gatewayIP scope=10 target-scope=30


Thus a Recursive Dual WAN failover using TWO external DNS sites to check connectivity in a simple FLAT approach would look like this....
/ip route
add check-gateway=ping distance=3 dst-address=0.0.0.0/0 gateway=1.0.0.1 scope=10 target-scope=12
add check-gateway=ping distance=4 dst-address=0.0.0.0/0 gateway=9.9.9.9 scope=10 target-scope=12
add distance=3 dst-address=1.0.0.1/32 gateway=Primary-gatewayIP scope=10 target-scope=11
add distance=4 dst-address=9.9.9.9/32 gateway=Primary-gatewayIP scope=10 target-scope=11
add comment=SecondaryISP distance=10 dst-address=0.0.0.0/0 gateway=Secondary-gatewayIP scope=10 target-scope=30


Thus a Recursive Dual WAN failover using TWO external DNS sites to check connectivity using the LAYERED or NESTED approach would look like this....
/ip route
add dst-address=0.0.0.0/0 gateway=10.10.10.10 scope=doesnt matter target-scope=14
+++++++++++++++++
add check-gateway=ping dst-address=10.10.10.10/32 gateway=1.0.0.1 scope=14 target-scope=13
add dst-address=1.0.0.1/32 gateway=Primary-gatewayIP scope=13 target-scope=12
+++++++++++++++++
add check-gateway=ping dst-address=10.10.10.10/32 gateway=9.9.9.9 scope=14 target-scope=13
add dst-address=9.9.9.9/32 gateway=Primary-gatewayIP scope=13 target-scope=12
+++++++++++++++++
add comment=SecondaryISP distance=10 dst-address=0.0.0.0/0 gateway=Secondary-gatewayIP scope=10 target-scope=30
Last edited by anav on Mon Apr 18, 2022 7:09 pm, edited 4 times in total.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Recursive Routes

Fri Apr 15, 2022 6:50 pm

So, you have a route that points to an IP of some gateway. That is the route from which you cannot use directly: it needs to be resolved to an interface. For that, you need another route which is a route resolving the previous one. That's what I called resolving route because I don't know any other terminology :)

So, technically you have two resolves when using "recursive routes" for failover (10.0.0.1 is provider's gateway here for simplicity):

Route1: 0.0.0.0/0 points to 8.8.8.8, which has target-scope=TS1

8.8.8.8 needs to be resolved to something, so we're using the next route:

Route2: 8.8.8.8/32 points to 10.0.0.1, having target-scope=TS2

Again, 10.0.0.1 is to be resolved via

Route3: 10.0.0.0/24 points to ether1 - as a connected route it has empty target-scope.

In RouterOS version <= 6, TS1 could be equal to TS2. Now it's required that TS1 > TS2 (to protect from possible loops?)
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18959
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Recursive Routes

Fri Apr 15, 2022 6:57 pm

Well okay you confused me with the 10.0.0.0./24 ether1 connected route, but if you meant a route existing within the router already, okay. :-)
I think Im finally on the same page. Thanks!
Thus you dont see any issue with the configs presented and I have explained the flat and nested approach properly?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18959
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Recursive Routes

Mon Apr 18, 2022 3:15 pm


1).Target Scope must be greater or equal to Scope, as it has always been.
2).Target Scope should decrease on each step of recursion (new in RouterOS v7)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3) Scope of next route should be not more than target-scope of your route (can be equal or less);
4) Target-scope of next route should be strictly less than target-scope of your route (this one was introduced in ROS v7);
...................................

Hi Chupaka I am trying to resolve the two different sets of rules you have stated, at separate locations, to ensure that they mean the same thing.!!

I think we can agree rather quickly that #2 and #4 are clear and consistent. In Ver7, TS should decrease for each step of recursion.
In other words, we have to compare TWO separate but related route entries when considering this rule. [TS on one rule, to TS on another rule]

Where its sticky for me is #1 and #3.
I think in the first line #1, you are saying that Each Route looked at in isolation (by itself) must have a relationship between its own Scope and Target Scope settings and more specifically the TS has to be equal or greater than the Scope. Therefore is summary, this rule only considers one rule at a time. S on one rule to TS on same rule

However in #3, you seem to imply this is not the case! You seem to be comparing the SCOPE of one rule to the TARGET SCOPE of another rule ????
Hence comparing two rules!! m S on one rule to TS on another rule

Please clarify!

Stated differently, clearly we have a TS to TS comparison between the resolving route and rescursive route pair!
However for the S to TS comparison of which you speak, are we applying that to the same route pair, or to every route rule individually (s to TS within same rule).


This is the logic of which I think you are speaking too...
FARTHEST ROUTE: SCOPE= (doesnt matter) / TARGET SCOPE=Y+2
CLOSER ROUTE: SCOPE= Y+2 or less / TARGET SCOPE=Y+1
CLOSEST ROUTE: SCOPE=Y+1 or less / TARGET SCOPE=Y (gateway=ISP)
INTERNAL ROUTE: ( within router, scope is not used, no recursive action at all )

Who is online

Users browsing this forum: No registered users and 24 guests