LXC on Proxmox


During the migration I've hit a minor problem that the LXC containter by default isn't allowed to access the TUN device. To solve this I had to add this line to the LXC config in /etc/pve/lxc/[ID].conf

lxc.cgroup.devices.allow = c 10:200 rwm

Make sure that you restart the container after you've added this line. Inside the container I had to add this code to the file /etc/rc.local

if ! [ -d /dev/net ];then
mkdir /dev/net
if ! [ -c /dev/net/tun ]; then
mknod /dev/net/tun c 10 200
chmod 666 /dev/net/tun

After this configuration the openvpn server worked without a problem.


I'm going to deploy OpenVPN with Ansible. Maybe I'm going to generate the certificats again from scratch. Or I'm copying I'm not sure yet