These are steps how to enable TUN/TAP on Proxmox LXC containers:
-
Make sure your container is PRIVILEGED, if not, then make a backup of the container, then restore it and check “Privileged Container”.
-
Shutdown container and edit its configuration file located under /etc/pve/lxc/CTID.conf (CTID is the ID of your container)
-
Add following lines at the end of file:
lxc.cgroup.devices.allow: c 10:200 rwm
lxc.hook.autodev: sh -c “modprobe tun; cd ${LXC_ROOTFS_MOUNT}/dev; mkdir net; mknod net/tun c 10 200; chmod 0666 net/tun”
- Save configuration file and start the container.
- Make sure TUN is enabled by running following command:
cat /dev/net/tun
This should output the following:
cat: /dev/net/tun: File descriptor in bad state
Now you can run VPN.