VPN in Proxmox VE Containers

Setting up a vpn in a proxmox container requires a workaround in order to enable tun kernel module

Fixing Tun Module Access in Proxmox Containers


🔧 Configuration Steps

To enable the tun kernel module in a Proxmox container, add the following lines to /etc/pve/lxc/CTID.conf (replace CTID with your container ID):

lxc.cgroup.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net dev/net none bind,create=dir

🛠 Ownership Adjustment

Set ownership of /dev/net/tun to allow access:

chown 10000:10000 /dev/net/tun

✅ Post-Setup

  1. Restart the container:
    pve-lxc restart CTID
    
  2. Verify device existence:
    ls /dev/net/tun
    

    The device should now appear.

⚠️ Notes

  • The tun module is not loaded by default.
  • The container can create the interface without the module.
  • If the module is missing, check kernel logs for errors (e.g., dmesg).