OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 19.1 Legacy Series »
  • NAT before IPSEC - Bug??
« previous next »
  • Print
Pages: [1]

Author Topic: NAT before IPSEC - Bug??  (Read 6047 times)

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
NAT before IPSEC - Bug??
« on: May 24, 2019, 11:18:54 am »
Hi,

I have tried to setup NAT before IPSEC.

Followed this how to doc:
https://docs.opnsense.org/manual/how-tos/ipsec-s2s-binat.html

Is it not working with 19.1?

I havn't tried with 18.7.

(tested with a pfSense instead of my opnsense box and then it is working)
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #1 on: May 24, 2019, 12:32:29 pm »
I have two machines with 19.1.4 where it's running fine, must be a configuration issue.
More detail about setup and error please
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #2 on: May 24, 2019, 12:45:54 pm »
LAN network: 192.168.17.0/24
OPNsense 19.1.7 - could it be kernel changes since 19.1.4?

IPSEC Phase 2 (tunnel up):
local network 10.222.15.0/24
remote network: 192.168.11.0/24
Manual SPD: 192.168.17.0/24

NAT 1:1:
Interface IPSEC
Type: BINAT
External network: 10.222.15.0/24
Source: 192.168.17.0/24
Destination: 192.168.11.0/24

Firewall:
Default LAN allow all rule.

I cannot ping 192.168.11.244 from 192.168.17.101 using the OPNsense firewall.

--
With pfSense I use:
Phase 2:
local network: 192.168.17.0/24
BINAT translation: 10.222.15.0/24
remote network: 192.168.11.0/24
« Last Edit: May 24, 2019, 12:47:25 pm by olest »
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #3 on: May 24, 2019, 08:17:57 pm »
tcpdump on enc0 please
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #4 on: May 24, 2019, 08:56:42 pm »
I get nothing when I use "tdpdump -i enc0" and ping 192.168.11.244.

(tested with other tunnels with no NAT and the I see the trafic with tcpdump)
Logged

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #5 on: May 24, 2019, 08:58:49 pm »
tcpdump at LAN interface igb1 I get:
20:57:51.045693 IP 192.168.17.101 > 192.168.11.244: ICMP echo request, id 1, seq 36150, length 40
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17707
  • Karma: 1618
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #6 on: May 24, 2019, 09:04:17 pm »
Consider me amazed if this is not VTI and pfSense works but you're using ping without -S parameter which would indicate the opposite.

IPsec (non-VTI) needs -S for the source address and IPsec said source address to accept traffic into the tunnel. Always.

# ping 192.168.77.1
PING 192.168.77.1 (192.168.77.1): 56 data bytes
^C
--- 192.168.77.1 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
# ping -S 10.0.0.1 192.168.77.1
PING 192.168.77.1 (192.168.77.1) from 10.0.0.1: 56 data bytes
64 bytes from 192.168.77.1: icmp_seq=1 ttl=255 time=56.350 ms
64 bytes from 192.168.77.1: icmp_seq=2 ttl=255 time=48.087 ms

IPsec from 10.0.0.1 -> 192.16.77.1


Cheers,
Franco
Logged

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #7 on: May 24, 2019, 09:15:26 pm »
Not sure what you mean or what you what me to test.

Quote from: franco on May 24, 2019, 09:04:17 pm
Consider me amazed if this is not VTI and pfSense works but you're using ping without -S parameter which would indicate the opposite.

IPsec (non-VTI) needs -S for the source address and IPsec said source address to accept traffic into the tunnel. Always.

# ping 192.168.77.1
PING 192.168.77.1 (192.168.77.1): 56 data bytes
^C
--- 192.168.77.1 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
# ping -S 10.0.0.1 192.168.77.1
PING 192.168.77.1 (192.168.77.1) from 10.0.0.1: 56 data bytes
64 bytes from 192.168.77.1: icmp_seq=1 ttl=255 time=56.350 ms
64 bytes from 192.168.77.1: icmp_seq=2 ttl=255 time=48.087 ms

IPsec from 10.0.0.1 -> 192.16.77.1


Cheers,
Franco
Logged

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #8 on: May 24, 2019, 09:20:51 pm »
Only SPDs with 192.168.11.0/24 I see is:
192.168.11.0/24  10.222.15.0/24
10.222.15.0/24    192.168.11.0/24

Should there not be any entry for the manual SPD?
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #9 on: May 24, 2019, 09:22:41 pm »
Can you try source in binat the LAN IP of the Firewall? Do you use FQDN for Peer address?
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #10 on: May 24, 2019, 09:31:06 pm »
Remote gateway is an IP address.
Identifiers is "Distinguished name"
Logged

mimugmail

  • Hero Member
  • *****
  • Posts: 6767
  • Karma: 494
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #11 on: May 24, 2019, 10:16:58 pm »
Can you check last comment if you are also affected?

https://github.com/opnsense/core/issues/1773
Logged
WWW: www.routerperformance.net
Support plans: https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German): https://opnsense.max-it.de/

olest

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 3
    • View Profile
Re: NAT before IPSEC - Bug??
« Reply #12 on: May 24, 2019, 10:28:50 pm »
Not the same setup (I don't have any of the routers behind NAT) but same problem.

If I change Phase 1 Identifiers to use IP address instead of Distinguished name the NAT before IPSEC is working.

Why does it not work if I use other than IP address as my identifier/peer identifier?
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 19.1 Legacy Series »
  • NAT before IPSEC - Bug??
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2