[strongSwan] S2S vpn between strongswan and openbsd with NAT-T doesn't work

Mews, Flavius Flavius.Mews at voith.com
Wed Nov 8 15:25:58 CET 2017


I have an issue with strongswan and an openbsd S2S VPN with NAT between the two endpoints. I have this
issue in the live-envrionment. So I installed a testenvironment under virtualbox. I was able to reproduce this issue.
The vpn connection is shown as established but the tunnel is not installed as "ESP in UDP" although the negotiation
goes over port 4500 and nat was detected. If I disable NAT in the Gateway the VPN works well.
The Openbsd box sends out udp encap packets (if i do a ping from openbsd to ubuntu-server like: ping -I The Packets reach
the ubuntu-server but then i see no reply. I Think this is because the tunnel isn't established as udp encap mode. I attached tcpdump captures from both machines.
Does anyone know where the failure is? Is it a configfailure?
Thanks in advance.

Here is my setup: 16.04.3 LTS [VPN Endpoint: IP] ======= [NAT-Address to ubuntu server] NAT-GW-(OpenBSD 6.1) ===== [VPN Endpoint: VPN Endpoint: IP] OpenBSD 6.1===

===============<===============================<=============================< VPN is initiated from OpenBSD Box to ubuntu server<=======================================================<

runs with 
root at ubuntu-vpn-gw:~# ipsec version
Linux strongSwan U5.3.5/K4.4.0-87-generic

root at ubuntu-vpn-gw:~# cat /etc/ipsec.conf
# ipsec.conf - strongSwan IPsec configuration file
# basic configuration
config setup
        # strictcrlpolicy=yes
        uniqueids = yes
        charondebug = "ike 3, esp 3, cfg 3, enc 1, lib 2, mgr 3, net 3"

		include /etc/ipsec.d/connections/

connection voith-opnbsdapu
root at ubuntu-vpn-gw:~# cat /etc/ipsec.d/connections/voith-openbsdapu.conf
conn voith-openbsdapu
root at ubuntu-vpn-gw:~# ipsec statusall
Status of IKE charon daemon (strongSwan 5.3.5, Linux 4.4.0-87-generic, x86_64):
  uptime: 29 minutes, since Nov 08 13:42:12 2017
  malloc: sbrk 1486848, mmap 0, used 344048, free 1142800
  worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 2
  loaded plugins: charon test-vectors aes rc2 sha1 sha2 md4 md5 random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp agent xcbc hmac gcm attr kernel-netlink resolve socket-default connmark stroke updown
Listening IP addresses:
voith-openbsdapu:  IKEv1
voith-openbsdapu:   local:  [] uses pre-shared key authentication
voith-openbsdapu:   remote: uses pre-shared key authentication
voith-openbsdapu:   child: === TUNNEL
Security Associations (1 up, 0 connecting):
voith-openbsdapu[1]: ESTABLISHED 29 minutes ago,[]...[OpenBSD61-VM-4.my.domain]
voith-openbsdapu[1]: IKEv1 SPIs: 39ffa08de8e70bf9_i 1e9d80f29e97d882_r*, pre-shared key reauthentication in 7 hours
voith-openbsdapu[1]: IKE proposal: AES_CBC_256/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_1536
voith-openbsdapu{2}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: c2742000_i bd0678b6_o
voith-openbsdapu{2}:  AES_CBC_256/HMAC_SHA2_256_128, 0 bytes_i, 0 bytes_o, rekeying in 34 minutes
voith-openbsdapu{2}: ===

openbsd 6.1
isakmpd and ipsecctl

root at OpenBSD61-VM-4:/root # cat /etc/ipsec.conf

local_network           = ""
local_vpn_endpoint      = "em1"
remote_vpn_endpoint     = ""
remote_networks         = ""
phase_one               = "hmac-sha2-256 enc aes-256 group modp1536"
phase_two               = "hmac-sha2-256 enc aes-256 group none"

ike dynamic esp from $local_network to $remote_networks \
        local $local_vpn_endpoint peer $remote_vpn_endpoint \
        main auth $phase_one \
        quick auth $phase_two \
        psk "MYSECRET"
root at OpenBSD61-VM-4:/root # ipsecctl -sa
flow esp in from to peer srcid OpenBSD61-VM-4.my.domain dstid type use
flow esp out from to peer srcid OpenBSD61-VM-4.my.domain dstid type require

esp tunnel from to spi 0xb244137a auth hmac-sha2-256 enc aes-256
esp tunnel from to spi 0xcc60d6ed auth hmac-sha2-256 enc aes-256

root at OpenBSD61-VM-4:/root # isakmpd -dKvvvv
143012.343842 Default isakmpd: starting [priv]
143024.253407 Default isakmpd: phase 1 done: initiator id OpenBSD61-VM-4.my.domain, responder id, src: dst:
143024.256211 Default isakmpd: quick mode done: src: dst:

Best regards 

Flavius Mews

-------------- next part --------------
A non-text attachment was scrubbed...
Name: strongswan_syslog.log
Type: application/octet-stream
Size: 31622 bytes
Desc: strongswan_syslog.log
URL: <http://lists.strongswan.org/pipermail/users/attachments/20171108/ce993965/attachment-0001.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tcpdumps.txt
URL: <http://lists.strongswan.org/pipermail/users/attachments/20171108/ce993965/attachment-0001.txt>

More information about the Users mailing list