原因:lxc容器默认没有tun设备。
vim /etc/pve/lxc/{ID}.conf
# 7.0前
lxc.cgroup.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
# 7.0后
lxc.cgroup2.devices.allow = c 10:200 rwm
lxc.hook.autodev = sh -c "modprobe tun; cd ${LXC_ROOTFS_MOUNT}/dev; mkdir net; mknod net/tun c 10 200; chmod 0666 net/tun"
Reference |
---|
tun/tap broken in LXC in PVE 7 |