Community discussions

MikroTik App
 
pe1chl
Forum Guru
Forum Guru
Topic Author
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

How to dst-nat or redirect when routing marks are present

Mon Feb 26, 2024 5:32 pm

On a router with two ISP connections running 7.12.1 I am using route marks to load balance the traffic between the connections.
To do that, in mangle prerouting I assign a routing mark based on per-connection-classifier=src-address:2/x
This works fine. There are two extra routing tables for the 2 ISP containing the default route for each, one of them is also present in table main.
(there is a second entry with distance 2 for the other ISP in each of those tables)

Now, I want to dst-nat some outgoing traffic to the local router. E.g. DNS requests to a certain external server have to be redirected to the local DNS resolver.
The problem I encounter is that traffic dst-natted to a local address is not reachable via those alternate routing tables. So it does not work.
How can this be resolved? I have attempted to add routes to the alternative tables but I cannot find how to add a route for a local address of the router in such a way that it is routed locally to the DNS service.
Adding route rules for the local addresses also does not work for this case. I think in v7 the logic has changed so that route marks go before route rules.
(the solution worked OK in v6 but I have changed some things in the route rules setup since then so it is not really representative)

I had hope that "redirect" would work where "dst-nat to the router address" would not, but there is no difference.
 
Mesquite
Member
Member
Posts: 420
Joined: Tue Jan 23, 2024 9:16 pm

Re: How to dst-nat or redirect when routing marks are present

Mon Feb 26, 2024 9:00 pm

Good day Sir,
In plain english, do you mean you have two WANs conducing load balancing and now you at trying to figure out how to add LAN based servers in the mix............
viewtopic.php?t=204746
 
pe1chl
Forum Guru
Forum Guru
Topic Author
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 10:53 am

I mean what I wrote above, nothing else. I know how to make a load balancing setup, but now I want to combine it with dst-nat of some "outbound" traffic.
 
jaclaz
Long time Member
Long time Member
Posts: 669
Joined: Tue Oct 03, 2023 4:21 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 11:45 am

I mean what I wrote above, nothing else.
Do you mean that you believe you can get answers to your questions without providing (at the very least):
1) configuration export
2) full requirements
3) network layout

:?:
:lol:
 
pe1chl
Forum Guru
Forum Guru
Topic Author
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 12:08 pm

Remember it is not a question about "how do I get my config exactly right", it is a question about concepts in RouterOS.
"how can I get traffic with a routing mark handled locally at the router"
 
Mesquite
Member
Member
Posts: 420
Joined: Tue Jan 23, 2024 9:16 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 1:36 pm

With the proper mangling rules of course.................... what have you got so far! ;-)
 
jaclaz
Long time Member
Long time Member
Posts: 669
Joined: Tue Oct 03, 2023 4:21 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 5:10 pm

Remember it is not a question about "how do I get my config exactly right", it is a question about concepts in RouterOS.
"how can I get traffic with a routing mark handled locally at the router"
You are still trying to avoid providing the complete set of info using the conceptual excuse :shock: as ultimately you are going to apply the concepts to your configuration, your question is standing out as non-conformant.

I just wanted to make sure you are doing this intentionally and not by accident. :wink:
 
pe1chl
Forum Guru
Forum Guru
Topic Author
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

Re: How to dst-nat or redirect when routing marks are present

Tue Feb 27, 2024 5:54 pm

I am not interested in discussions at this level, so don't expect a reply to them.

Who is online

Users browsing this forum: sas2k and 42 guests