Creating a IKEv2 VPN tunnel as a client from HassOS to remote network

First: this is NOT about how to connect to my Home Assistant OS from outside. I know how to do this. This is a different use case:

  • I’m running Home Assistant OS on a RPi4 on my home network, with the usual devices (entities) connecte via LAN or WiFi. I also run a solar PV system - everything works well.
  • I have a 2nd PV system running on another site in another city. This system offers connectivity via a simulated ModBus serial interface on TCP/IP (EPEver Wifi Dongle).
  • Now I want to create a VPN tunnel from my home to the remote site (via its router) so I can get the data from this EPEver WiFi Dongle.
  • The VPN needs to be IKEv2/PSK or L2TP (I would not prefer that). Because that’s what the other router supports.

All the documentation I have found were about having VPN servers on the OS, but now how to get a VPN client running. I tried the way I would do it on Debian, via nmcli etc, but the network-manager for ikev2 is not pre-installed.
I’m not sure if HassOS allows any packages to be installed at all. I understand that would kind of defeat the purpose of HassOS. But is it possible?

Well, I am by far not a Home Assistant guru (or anything the like) but what I can imagine is, that you could at least use a docker container as VPN client (strongx509/strongswan ?) and setup a static route on your HA instance so the tunnel gets used for a specific subnet/ip-address… And of course the other/remote network must also know that your local network is accessible through the VPN tunnel.

I’ve got a Wireguard setup, with a static route so my HA instance (and add-ons) can communicate with the VPN clients - not exactly your scenario, but tells me that you can do a lot - so I’d say: Possible? Yes, definitely somehow!


Add: Although I wouldn’t setup VPN like that again. I would try to setup the “Site-to-Site” VPN on a dedicated network-device which is not coupled to the power-/system-cycle of the HA instance.

1 Like