Community discussions

MikroTik App
 
Huishu
just joined
Topic Author
Posts: 4
Joined: Sat Apr 23, 2022 5:47 am

Routing priority issue

Thu Jun 09, 2022 9:37 am

Since routeros version 7.2.2. mark routing has a higher priority than routing/rules. version 7.2.3 and 7.3 also like this.
Is this a bug or a feature change?
 
User avatar
dioeyandika
just joined
Posts: 19
Joined: Fri Feb 08, 2019 11:30 am

Re: Routing priority issue

Thu Jun 09, 2022 10:13 am

Since routeros version 7.2.2. mark routing has a higher priority than routing/rules. version 7.2.3 and 7.3 also like this.
Is this a bug or a feature change?
its not clear yet, i believe bug no much information about that in changelog also, i stay in 7.2.1 until this bug fix
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Routing priority issue

Thu Jun 09, 2022 11:49 am

Mangle has now strictly the highest priority.
 
Huishu
just joined
Topic Author
Posts: 4
Joined: Sat Apr 23, 2022 5:47 am

Re: Routing priority issue

Thu Jun 09, 2022 12:08 pm

Mangle has now strictly the highest priority.
Why isn't there any information about this in the changelog.
This is a big change. Many people think this is a bug.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Routing priority issue

Thu Jun 09, 2022 12:12 pm

Mangle on Forward happen after Routing decision.
Is perfectly normal the behaviour that what is done on Routing can be replaced on Mangle.
Then the actual behavior on v7 is what is expected.
On previous v6, is like a bug, following the packet flow.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Routing priority issue

Thu Jun 09, 2022 2:36 pm

@rextended routing can be marked only in prerouting and output

For explanation how it works see this:
viewtopic.php?p=938483#p938483

The change was made to fix the problems marking VRF traffic with the mangle.
It was always not recommended to override mangle with routing rules, if you had this setup previously, then yes unfortunately you have a broken setup now.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 2:37 pm

I never really played with it there, but AFAIK Linux has this configurable (see "ip rule") and default is what RouterOS had previously. It's not necessarily the only right choice, it can be what RouterOS has now. The bad thing is changing something like this without any warning whatsoever. I'm pretty sure that many people with load balancing previously marked routing without excluding router as destination, something like:
/ip route
add dst-address=0.0.0.0/0 gateway=xx routing-table=wan1
add dst-address=0.0.0.0/0 gateway=xx routing-table=wan2
/ip firewall mangle
add chain=prerouting in-interface=LAN connection-state=new per-connection-classifier=something/0 action=mark-connection new-connection-mark=wan1
add chain=prerouting in-interface=LAN connection-state=new per-connection-classifier=something/1 action=mark-connection new-connection-mark=wan2
add chain=prerouting in-interface=LAN connection-mark=wan1 action=mark-routing new-routing-mark=wan1
add chain=prerouting in-interface=LAN connection-mark=wan2 action=mark-routing new-routing-mark=wan2
And why not, it always worked. But now if they upgrade, they suddenly won't be able to access router. Most will probably have enabled access using MAC address, but it will still cause a lot of confusion. And again, the main problem, there was no warning.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Routing priority issue

Thu Jun 09, 2022 2:41 pm

Your mentioned setup will not break, there is no routing rules
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 2:48 pm

Well, then maybe it's not exactly this but something related and unintended, but it does break. If destination is local address, then packet with routing marked like this no longer goes in chain=input, but in chain=forward. Something that previously was possible only using action=route.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 3:29 pm

And the intended change in routing rules, it's also slightly annoying. If I understand it correctly, it means that my handy foolproof shortcut (= use main routing table for selected destination no matter what routing mark it has):
/ip route rule
add dst-address=192.168.0.0/16 action=lookup-only-in-table table=main
is now dead. With a config like I posted, it nicely handled both other LAN subnets and hairpin NAT. It can be done differently by adding dst-address-list=!LANs dst-address-type=!local to mangle rules, so I guess it won't be a problem. But it will requires some config fixes. Oh well..
 
User avatar
dioeyandika
just joined
Posts: 19
Joined: Fri Feb 08, 2019 11:30 am

Re: Routing priority issue

Thu Jun 09, 2022 3:53 pm

@Sob thanks for mention this problem, most of us choosing MikroTik because load balance, now the change break something important like this i will considered not upgrading to newer version, mrz say that change for fix VRF marking but honestly most of us dont even use VRF just a simple load balance like in version 6, the reason i upgrade to ROS v7 is wireguard and new queue type (Codel, Cake etc) well maybe is pain the ass :) but i will bear it :lol: :lol:
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Routing priority issue

Thu Jun 09, 2022 4:19 pm

It was curious what was up with this and it indeed a nasty one. My config was also broken. Looking in the mangle pre-routing routing marking the counters did not increase. Only the one catching traffic that should be mangled but has not been not mangled and setting the TTL to zero, to avoid traffic going out a wrong exit.

In the new-mark-routing lines, I had the condition that traffic should be routing table main. Now traffic is not automatically put in table main first, and then you can change that to an other routing table.

My routing table looks like this:
   Name FIB
   aaa   yes
   bbb   yes
D  main  yes
   wg-1  yes
   wg-2  yes
I have had to remove all checks on routing table main and I have no replacement for main on the moment.

Is this the way to get the previous working back to have all traffic be default "main"?
/routing rule
add action=lookup disabled=no table=main
Last edited by msatter on Thu Jun 09, 2022 4:25 pm, edited 3 times in total.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 4:20 pm

@dioeyandika: Well, it definitely needs clarification what's intended and what isn't. But it's not hopeless, you should be able to do what you need, you'll just have to be more careful with what you mark routing for.
 
User avatar
dioeyandika
just joined
Posts: 19
Joined: Fri Feb 08, 2019 11:30 am

Re: Routing priority issue

Thu Jun 09, 2022 4:35 pm

It was curious what was up with this and it indeed a nasty one. My config was also broken. Looking in the mangle pre-routing routing marking the counters did not increase. Only the one catching traffic that should be mangled but has not been not mangled and setting the TTL to zero, to avoid traffic going out a wrong exit.

In the new-mark-routing lines, I had the condition that traffic should be routing table main. Now traffic is not automatically put in table main first, and then you can change that to an other routing table.

My routing table looks like this:
   Name FIB
   aaa   yes
   bbb   yes
D  main  yes
   wg-1  yes
   wg-2  yes
I have had to remove all checks on routing table main and I have no replacement for main on the moment.

Is this the way to get the previous working back to have all traffic be default "main"?
/routing rule
add action=lookup disabled=no table=main
hem i thought remove all checks in FIB it wont show in mangle routing mark, and how about 0.0.0.0/0 destination are we need to delete this too in ip route?
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Routing priority issue

Thu Jun 09, 2022 5:35 pm

If traffic is not route marked main by default anymore how do I see what the assigned routing mark is. Mikrotik writes the one with the strictly order/priority.

Then having a "no-mark" routing-mark in the mangle like as with connection-mark could then detect traffic not yet routing marked. Main is an mark, and now the same status as other routing marks except it dynamically generated. If I look in /ip/route loads of lines have main as default routing table.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 5:50 pm

@msatter: Can you give some more understandable simple example? I'm trying different things and so far I didn't find any problem with main routing table. Even if I do action=mark-routing new-routing-mark=main, it seems to work as if I didn't do any marking.
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Routing priority issue

Thu Jun 09, 2022 6:20 pm

Filtering on active routing-mark:
add action=mark-routing chain=prerouting new-routing-mark=WireGuard routing-mark=main

Looking at routing-mark=main to see if there is already a routing mark present. When not then route-mark traffic
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 6:43 pm

I don't see any change there. If I do this:
/ip firewall mangle
add chain=prerouting routing-mark=main action=log log-prefix=1-main
add chain=prerouting routing-mark=!main action=log log-prefix=1-notmain
add chain=prerouting new-routing-mark=test action=mark-routing
add chain=prerouting routing-mark=main action=log log-prefix=2-main
add chain=prerouting routing-mark=!main action=log log-prefix=2-notmain
add chain=prerouting action=mark-routing new-routing-mark=main
add chain=prerouting routing-mark=main action=log log-prefix=3-main
add chain=prerouting routing-mark=!main action=log log-prefix=3-notmain
Then I get: 1-notmain, 2-notmain, 3-main in 7.4beta2 as well as in 6.49.6.
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Routing priority issue

Thu Jun 09, 2022 7:09 pm

before: 1-main 2-not-main 3-main
now: 1-not-main 2-not-main 3-main

My problem is 1-not-main now because before all traffic was main. That is why we don't have no no-mark option in routing...as it is always marked according to ROS. That has been changed now since 7.2rc6 and before.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 7:21 pm

It looks like there was change between v6 and v7 and later in v7 there was another. I now tested two (edit: four) more and I see:

1-notmain, 2-notmain, 3-main in 6.48.6
1-main, 2-notmain, 3-main in 7.1.5
1-main, 2-notmain, 3-main in 7.2.1
1-notmain, 2-notmain, 3-main in 7.2.2

So yes, it's also between 7.2.1 and 7.2.2. And nothing in changelog that would warn you. :(
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Routing priority issue

Thu Jun 09, 2022 7:44 pm

I would like to see a feature in /routing/tables, where there would be a checkmark for a table "add connected routes".
When set, it would add the interface connected routes (that are in table main) also to this table.

I think that would solve a lot of the issues that people now encounter with the changed route mark behavior. A packet with a route mark would still be able to be locally routed, because local connections appear in that table (when you wish).
Do others agree that this would be a welcome addition?
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Thu Jun 09, 2022 8:09 pm

I would like to start with clarification about current state, all the things that were changed and how, what's intended behaviour (because at least something may not be), etc.

Adding connected routes to other routing tables sounds possibly useful, but I'm not sure how it would interact e.g. with VRF where there are also connected routes, but in other than main routing table. So if it should be only for connected routes in main routing table, or also for others. It's complex stuff, I can't say that I understand all details.
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Routing priority issue

Thu Jun 09, 2022 8:13 pm

Thanks for confirming this. I am back to 7.2rc6 due to a problem with IPTV streams breaking and now that gives problems. :(

Update:
Found the cause why the IPTV steams where breaking up. It was quite a search and even WireGuard did not give away why. Using torch I noticed that traffic was returning that had as destination the VPN gateway. That traffic intermingled with the IPTV traffic and changed the destination address.

The traffic that caused it where pings to test if the connection was still open and those where generated on the router itself. As soon as I deactivated ping the IPTV stream was rock solid again.

I am using a lookup only routing for IPTV traffic and the ping uses the same table. Strange that parallel traffic has this effect on traffic that has a different destination address.

Has anyone a clue how this can be avoided without disabling the pings I use?

addition: the destination address (traffic returning) is in the same /24 range as the VPN gateway. This way I don't have to use NAT for this traffic. It could be that the VPN provider prefers to return traffic to the gateway when things are not clear to them.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Routing priority issue

Fri Jun 10, 2022 6:00 pm

Table can be vrf and adding the same connected routes to every table is very bad idea especially if the table is vrf.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Routing priority issue

Fri Jun 10, 2022 7:07 pm

When you use VRF this option would of course not be chosen.
Please make a documentation page that describes exactly how the route marking, routing rules and VRF operate together, including all priorities and possibilities to mix them (or things you cannot mix).
In our network, the use of VRF often results in transmissions from router with wrong source address (traffic to tunnels with outside address as source), and I want to know exactly what can be done and what not.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Mon Jun 20, 2022 4:07 pm

Today I have received promising reply to my SUP-81294:
Hi,
The issue is still unresolved that could cause this, we are working on possible fixes. I cannot give you any specific ETD for this, unfortunately.
Best regards,
Oskars K.
So it seems that this undocumented routing priority changes they understand as an "issue" :) I stay on 7.2.1 or 6.49.5 and waiting...
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Routing priority issue

Mon Jun 20, 2022 4:34 pm

"issue" in a sense that many expect old behaviour. Probably this will be solved by making order selectable.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Mon Jun 20, 2022 5:33 pm

"issue" in a sense that many expect old behaviour. Probably this will be solved by making order selectable.
So now it sounds like an intention from your side. Then I do not undestand why this major change was not documented in fw 7.2.2/7.2.3 change log (?) and why you cannot provide step-by-step help what to change in related config of i.e. dualwan scenario to be working again?
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Mon Jun 20, 2022 7:13 pm

With current version, if you don't want something use another routing table, then don't mark routing for it. So e.g. if problem is access to router like in this example, then add dst-address-type=!local to first two rules.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Mon Jun 20, 2022 10:17 pm

With current version, if you don't want something use another routing table, then don't mark routing for it. So e.g. if problem is access to router like in this example, then add dst-address-type=!local to first two rules.
Thanks but I cannot see the posiblity to add this option to rule via Winbox?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Routing priority issue

Mon Jun 20, 2022 10:20 pm

It is on the "Extra" tab. Once you open the Dst.Address Type it will show the options.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Mon Jun 20, 2022 10:36 pm

Could you show me some screenshot? I have no Dst Address Type option there under ip/route. Maybe is not available on 7.2.1? (I am trying to add this option first before the upgrade now)
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1059
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Routing priority issue

Mon Jun 20, 2022 11:09 pm

Screenshot 2022-06-20 at 22.05.53.png
You do not have the required permissions to view the files attached to this post.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Mon Jun 20, 2022 11:17 pm

Eh..but it is firewall rule. First two rules in the refered example are for /ip route , not /ip firewall
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1059
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Routing priority issue

Tue Jun 21, 2022 12:08 am

Was referring to the mangle rules in the reply from sob (in the linked post):
Sob wrote: With current version, if you don't want something use another routing table, then don't mark routing for it. So e.g. if problem is access to router like in this example, then add dst-address-type=!local to first two rules.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Tue Jun 21, 2022 9:44 am

Was referring to the mangle rules in the reply from sob (in the linked post):
Sob wrote: With current version, if you don't want something use another routing table, then don't mark routing for it. So e.g. if problem is access to router like in this example, then add dst-address-type=!local to first two rules.
OK, did a try, it solves unreachability of the router itself but still issue with nonworking routing rules under Routing/Rules ?
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: Routing priority issue

Tue Jun 21, 2022 9:54 am

OK, did a try, it solves unreachability of the router itself but still issue with nonworking routing rules under Routing/Rules ?
Because in this release, the routing-mark assigned by a mangle rule cannot be superseded using a routing rule. So the rules are not "nonworking" per se, it's just that their purpose was to supersede the verdict of the mangle rules and they can't do that any more.

We'd have to see the configuration export to say how exactly the mangle rules need to be modified to gain the same effect you currently obtain by overriding them using routing rules.
 
IntLDaniel
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Apr 04, 2019 7:21 pm

Re: Routing priority issue

Tue Jun 21, 2022 10:05 am

Because in this release, the routing-mark assigned by a mangle rule cannot be superseded using a routing rule. So the rules are not "nonworking" per se, it's just that their purpose was to supersede the verdict of the mangle rules and they can't do that any more.

We'd have to see the configuration export to say how exactly the mangle rules need to be modified to gain the same effect you currently obtain by overriding them using routing rules.
I have a static routing and related routing rules to reach directly (not via internet) some public IPs assigned to local devices or other routers in our network but also some sort of local subnets and device IPs to reach localy...all of them does not work. As I mentioned above, if developers do silently this major change, I would expect BIG warning and step by step manual what need to be check and change in the configuration to meet this new router behaviour. Now it seems that they will provide some option to switch router to the previous standard behaviour.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Routing priority issue

Tue Jun 21, 2022 10:57 am

As mentioned before, I hope the actual behavior will be well-documented. It does not matter that much what it exactly is, as long as we know what it is without blindly trying.
(this is about routing rules, routing marks, and also VRF)
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Routing priority issue

Tue Jun 21, 2022 11:52 am

As I see it (corrections welcome), previously it was:

- if destination is local, send it to router (input chain; routing rules and routing marks are ignored) (#1)
- check routing rules (can override routing marks) (#2)
- if there's routing mark, use given routing table
- otherwise use main routing table

Currently it's:

- if there's routing mark, use given routing table (is there's default route in this table, it's the end)
- check routing rules
- otherwise use main routing table

So there are two problems:

#1 - this is gone, local destination is no longer special
#2 - you can no longer override routing marks using routing rules

I don't know about VRF, that thing is kind of weird as whole (but I admit that I'm probably wrong).
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Routing priority issue

Tue Jun 21, 2022 12:03 pm

Yes, what I want is a complete picture that includes VRF, because like you I have never been able to design a system using VRF that does exactly what I want.
I think it would be possible when I exactly knew the interaction between VRF, routing rules, and routing marks.
(i.e. how you can use routing rules and/or routing marks to partially override the operation of VRF)
The existing documentation suggests that it would be possible, but doesn't tell how. And it is too much work for me finding out by poking in the black box.

At the moment I run a VRF-like configuration using routing rules with source interface as a matcher, but it requires additional rules based on source address because "local router originated" traffic cannot be matched that way. And unfortunately it also requires manual copying of connected routes to the second table.
With VRF it could be better, but unfortunately it also makes wrong decisions w.r.t. source address selection, at least as far as I observed.
With a combination, it could be OK.

Who is online

Users browsing this forum: Bing [Bot], grayfoxbsd, MarkusT, Question and 160 guests