Tuesday, August 29, 2017

Enable Tun/Tap in Proxmox 4 LXC Containers

In your host server (Where Proxmox is installed)

Replace all the below "$ID" with your container ID (CT id)

Shutdown your container:
pct shutdown $ID

Edit the LXC configuration file
vim /etc/pve/lxc/$ID.conf

Add the following 2 lines at the end of the file
lxc.hook.autodev: /var/lib/lxc/$ID/tuntap
lxc.cgroup.devices.allow = c 10:200 rwm

Create the tuntap file in /var/lib/lxc/$ID
vi /var/lib/lxc/$ID/tuntap

and paste the following in it:
mkdir net
mknod net/tun c 10 200
chmod 0666 net/tun

Make the tuntap file executable
chmod +x /var/lib/lxc/$ID/tuntap

Start your container:
pct start $ID

In your container, check that Tun/Tap is enabled:

cat /dev/net/tun

If Tun/Tap is enabled and active you will see the following message:
cat: /dev/net/tun: File descriptor in bad state

Questions or Comments? Leave them below!

No comments:

Post a Comment