0

I am using the DHCP plugin with dnsmasq.

$ cat /etc/dnsmasq.d/01-dhcp-loopback.conf
interface=lo
dhcp-range=10.0.2.10,10.0.2.254,255.255.255.0
port=0
$ cat /etc/ipsec.conf
config setup
  charondebug="ike -1, knl -1, cfg -1"
  uniqueids=never

conn ikev2
  auto=add
  compress=no
  type=tunnel
  keyexchange=ikev2
  fragmentation=yes
  forceencaps=yes
  ike=aes256gcm16-prfsha512-ecp384!
  esp=aes256gcm16-ecp384!
  dpdaction=clear
  dpddelay=300s
  rekey=no
  left=%any
  leftid=my-vpn.com
  leftcert=vpn-server.crt
  leftsendcert=always
  leftsubnet=0.0.0.0/0
  right=%any
  rightid=%any
  rightauth=eap-tls
  rightdns=1.1.1.1,1.0.0.1
  rightsourceip=%dhcp
  rightsendcert=never
  eap_identity=%identity

Edit

I was able to fix the issue adding the following to /etc/network/interfaces.

auto eth0:1
iface eth0:1 inet static
  address 10.0.2.1/24

That being said, I would love to know if this is the right way to solve the issue.

sunknudsen
  • 581
  • 10
  • 26

1 Answers1

0

Figured it out using a dummy interface vs lo.

The dummy interface is created by appending the following to /etc/network/interfaces and enabling the interface using ifup strongswan0.

auto strongswan0
iface strongswan0 inet static
  address 10.0.2.1/24
  pre-up ip link add strongswan0 type dummy

Then, instead of creating /etc/dnsmasq.d/01-dhcp-loopback.conf, I created /etc/dnsmasq.d/01-dhcp-strongswan.conf.

$ cat /etc/dnsmasq.d/01-dhcp-loopback.conf
interface=strongswan0
dhcp-range=10.0.2.10,10.0.2.254,255.255.255.0
port=0

Finally, I configured strongswan0 vs lo in /etc/strongswan.d/charon-logging.conf.

$ cat /etc/strongswan.d/charon/dhcp.conf
dhcp {
    force_server_address = yes
    identity_lease = yes
    interface = strongswan0
    load = yes
    server = 10.0.2.1
}
sunknudsen
  • 581
  • 10
  • 26