Tun in lxc¶
Shutdown the CT
Using a script file¶
Create a script /var/lib/vz/tun
#!/bin/bash cd ${LXC_ROOTFS_MOUNT}/dev mkdir net mknod net/tun c 10 200 chmod 0666 net/tun
Make the script executable
chmod +x /var/lib/vz/tun
Edit container configuration file (/etc/pve/lxc/id.conf)
lxc.autodev: 1 lxc.hook.autodev: /var/lib/vz/tun lxc.cgroup.devices.allow: c 10:200 rwm
In the LXC conf¶
Edit container configuration file (/etc/pve/lxc/id.conf)
lxc.autodev: 1 lxc.cgroup.devices.allow: c 10:200 rwm lxc.hook.autodev = sh -c "cd ${LXC_ROOTFS_MOUNT}/dev; mkdir net; mknod net/tun c 10 200; chmod 0666 net/tun"