Fixing the configuration of a TurnKey OpenVPN container on Proxmox
When using the TurnKey template on Proxmox to create an OpenVPN server, after setting it up following the container installation steps, we may run into an error where VPN clients cannot connect. To look into the errors in more detail, we can edit the OpenVPN server configuration file in /etc/openvpn/server.conf and add the lines:
log /var/log/openvpn/openvpn.log
log-append /var/log/openvpn/openvpn.logAnd if we need more detail, we also change to
verb 5Restart the OpenVPN server
systemctl restart openvpnWe can check the errors in the log file created in /var/log/openvpn, with the name set in the configuration, which in my case is openvpn.log. In it we will find an error saying the tun interface could not be created. This message appears because the container is not allowed to create certain devices, since it is configured to run in “unprivileged” mode. To get around this, do the following: Shut down the container. On Proxmox, add the following to the container’s configuration file in /etc/pve/lxc, named XXX.conf (where XXX is the container number, for example 102.conf):
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=fileThen we can start the container again and try our VPN connection. If we check the logs, the error message is gone.