How to enable tun/tap inside LXC

How to enable tun/tap inside LXC

To enable the tun/tap interface in a LXC container – eg. for openvpn – one needs to edit the LXC configuration file.

Its default location is:


and you have to add:

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

This works in proxmox 4.0, too.

To actually use a tun/tap device it must be created inside the container on every boot, so add the following to your /etc/rc.local inside your container:

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

thats it!