Community discussions

MikroTik App
 
madox
newbie
Topic Author
Posts: 28
Joined: Fri Jan 02, 2015 12:52 pm

Problem with OPENVPN and mangle

Sat Aug 26, 2017 1:08 am

Hello!

I have little problem which i don't know how to solve.
I have created OPENVPN and client connection and that part is working fine.
When mangle rule to route traffic over cable modem is enabled vpn client can't see NAS.
Router ip: 192.168.32.1, NAS 192.168.32.3 port 6541
Client over VPN 192.168.32.44
DDNS is noip...

There are two WAN connections: pppoe VDSL, and DHCP cable.

Routes
dst. address 0.0.0.0/0, gateway VDSL, distance 1, routing mark to_vdsl
dst. address 0.0.0.0/0, gateway VDSL, distance 2
dst. address 0.0.0.0/0, gateway cable, distance 1, routing mark to_cable
dst. address 0.0.0.0/0, gateway cable, distance 1

NAT
srcnat, src. address 192.168.32.44, dst. address !192.168.32.44, action: masquerade
srcnat, src. address 192.168.32.3,out. interface cable modem, action: masquerade

MANGLE
chain: prerouting, src. address 192.168.32.3, in. interface:lan bridge, action: mark routing, new routing mark to_cable

When mangle rule is disabled everything is working fine, when is enabled NAS is no longer available over VPN. Where is the problem?

Thx in advance
 
User avatar
pukkita
Trainer
Trainer
Posts: 3051
Joined: Wed Dec 04, 2013 11:09 am
Location: Spain

Re: Problem with OPENVPN and mangle

Sun Aug 27, 2017 6:54 pm

MANGLE
chain: prerouting, src. address 192.168.32.3, in. interface:lan bridge, action: mark routing, new routing mark to_cable

When mangle rule is disabled everything is working fine, when is enabled NAS is no longer available over VPN. Where is the problem?
As you have guessed, on that mangling: you're forcing all routed replies from the NAS to egress via cable modem.

Mangle and routing manipulation needs careful settings, considering all possible scenarios; otherwise (as you experienced) routing breaks on unpredictable ways.

You cannot just blindly force outgoing traffic to go towards an arbitrary WAN on a dual WAN scenario; internal outgoing connections are not the same as replies to previously ingress traffic. You need to make sure instead that traffic entering by a given WAN gets any replies through the same one.

In your specific scenario, traffic enters via VPN towards the NAS, but its replies are forced through cable WAN, whereas it should be left alone so that it returns via VPN. If cable WAN goes offline, NAS initiated traffic towards internet will also break.

Have a look at Tomas Kirnak's Load Balance / Mangle Deep Dive presentation to get a good understanding.
 
tangram
Member Candidate
Member Candidate
Posts: 132
Joined: Wed Nov 16, 2016 9:55 pm

Re: Problem with OPENVPN and mangle

Mon Aug 28, 2017 2:34 pm

As pukkita pointed out, that presentation is very good for your problem.

You need to isolate the traffic from lan to vpn and not pass it through your mangle rules.
Easiest way: mangle - prerouting src lan class - dst vpn class, set to accept.
 
alicemay
just joined
Posts: 1
Joined: Wed Aug 30, 2017 5:09 pm

Re: Problem with OPENVPN and mangle

Wed Aug 30, 2017 5:21 pm

check this video this will be solve your problem.https://www.youtube.com/watch?v=AZePBBbp_5w
 
madox
newbie
Topic Author
Posts: 28
Joined: Fri Jan 02, 2015 12:52 pm

Re: Problem with OPENVPN and mangle  [SOLVED]

Fri Sep 01, 2017 12:39 am

THNX !!!

Problem solved!!!
 
freddylocks
just joined
Posts: 7
Joined: Tue Sep 12, 2017 10:43 pm

Re: Problem with OPENVPN and mangle

Fri Sep 15, 2017 12:40 pm

Hi Madox

What did you do to resolve the problem?
I have the same problem at present that I am trying to resolve.

Many Thanks
Freddy
 
warllo
just joined
Posts: 16
Joined: Thu Mar 26, 2015 3:26 pm

Re: Problem with OPENVPN and mangle

Fri Oct 05, 2018 12:58 am

Hi,

I have a similar problem I created a vpn connection for privacy which works great after creating the mangle rule but now when I connect to my remote access vpn clients that use the privacy vpn cannot be reached from the remote access vpn. Any suggestions to restore? It works fine if I disable the mangle rule.

Who is online

Users browsing this forum: qatar2022 and 222 guests