Community discussions

MikroTik App
 
oreggin
Member Candidate
Member Candidate
Topic Author
Posts: 201
Joined: Fri Oct 16, 2009 9:21 pm

IPSec ESP over UDP without NAT

Wed Jan 20, 2021 2:11 pm

Hi,
Is there a way to make ESP encapsulation work over UDP and not using ip protocol 50 (ESP)?
My setup is public addressed HUB and Spokes with enabled nat traversal and I would like if MTik routers sending ESP packet over UDP and not in ESP packets because of transport network has FW between them and ESP can't pass through on it.
It is working only behind NAT or I can somehow set it in RouterOS?
Thanks!
oreggin
 
User avatar
16again
Frequent Visitor
Frequent Visitor
Posts: 78
Joined: Fri Dec 29, 2017 12:23 pm

Re: IPSec ESP over UDP without NAT

Wed Jan 20, 2021 9:39 pm

Could be as simple as checking "NAT Traversal" on your IPSEC profile
 
oreggin
Member Candidate
Member Candidate
Topic Author
Posts: 201
Joined: Fri Oct 16, 2009 9:21 pm

Re: IPSec ESP over UDP without NAT

Wed Jan 20, 2021 10:25 pm

/ip ipsec profile
set [ find default=yes ] dh-group=ecp521 dpd-interval=2m dpd-maximum-failures=5 enc-algorithm=aes-256 hash-algorithm=sha256 lifetime=1h name=default \
    nat-traversal=yes proposal-check=obey
triple checked, same on both side
 
Sob
Forum Guru
Forum Guru
Posts: 9188
Joined: Mon Apr 20, 2009 9:11 pm

Re: IPSec ESP over UDP without NAT

Thu Jan 21, 2021 3:20 am

Try to set local-address for peer to some local but not public address. That should trigger NAT detection. I'm not completely sure, I know that I tested it in the past, but can't remember how it went.
 
User avatar
16again
Frequent Visitor
Frequent Visitor
Posts: 78
Joined: Fri Dec 29, 2017 12:23 pm

Re: IPSec ESP over UDP without NAT

Sat Jan 23, 2021 12:44 pm

If you can't force encapsulation, adding nat to the picture makes sense as a workaround.
Make sure to add dNAT rules, so connection can also be initiated from remote. And you probably already have masquerade
 
oreggin
Member Candidate
Member Candidate
Topic Author
Posts: 201
Joined: Fri Oct 16, 2009 9:21 pm

Re: IPSec ESP over UDP without NAT

Mon Feb 08, 2021 12:54 pm

Thanks, this is a common problem in ISP networks if there is a nonESPcapable FW in the path then IPSec is dead. I suggested to customers using IPSec peers behind NAT and now it is works fine. Would be nice an RFC standard for IPSec then we could configure it to use UDP on public networks too.