Enable Tun/Tap in a Proxmox LXC Container

E

If you are trying to install OpenVPN onto a Proxmox LXC container and the install keeps failing, its due to the module not being activated on the Proxmox node.

To correct the problem, login to your ROOT Proxmox node, (Not the LXC container) and edit the default configuration file for all LXC containers. If you don’t want to enable this feature for all LXC containers (including future ones) you can edit just the config of that specific VM.

 

The default config file for all VM’s is located at: /etc/lxc/default.conf

VM specific config files are located at: /etc/pve/lxc/(vmid)/(vmid).conf where is the ID number of your vm.

Add lxc.cgroup.devices.allow = c 10:200 rwm to the end of the file. (It’s the same for both the global config and the config of just the vm)

Now log out of the Proxmox node and SSH into your LXC container. You will have to add a few lines to the linux boot file so that it executes the tun/tap device on every boot.

Go to the /etc/rc.local file and add these lines of code before the @exit line.

if ! [ -c /dev/net/tun ]; then
mkdir -p /dev/net
mknod -m 666 /dev/net/tun c 10 200
fi

Now after a full reboot you should have a working tun/tap interface so you can install OpenVPN on your LXC Container.

This was tested on the latest version of Proxmox at the time of writing this post.

About the author

4 comments

By Nick

Recent Posts