A common problem I encounter is trying to use OpenVPN on Linux containers hosted using LXC. LXC containers are a great, low resource way to virtualise things but need some extra setup for OpenVPN. Typically you get an error that looks something like:
ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory
Step 1
On the host machine we need to add a few lines to the configuration file for the container. On a Proxmox host, the config file is typically located at ‘/var/lib/lxc/[CONTAINER NAME]/config
Add the below lines to the bottom of this file then stop and start the container to take effect:
## for openvpn lxc.mount.entry = /dev/net dev/net none bind,create=dir lxc.cgroup.devices.allow = c 10:200 rwm
Step 2
Four commands need to be run each time the container starts up, the easiest way to do this is edit /etc/rc.local and add them just before the bottom ‘exit 0’ line.
mkdir /dev/net mknod /dev/net/tun c 10 200 chmod 666 /dev/net/tun service openvpn restart
That should do it!
This does not work with latest proxmox.