lxc tun vpn device on more container?

openaspace

Active Member
Sep 16, 2019
486
13
38
Italy
As report the official guide it works.. (on the first lxc) .. but which is the correct /dev/net dev/net for others tun devices?


Code:
nano /etc/pve/lxc/123.conf

Add the following lines at the end (if you're using PVE < 7.0, change `cgroup2` with `cgroup`)

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

Press Ctrl-X and answer "Y" for saving and press Enter.

For your unprivileged container to be able to access the /dev/net/tun from your host, you need to set the owner by running:

 # chown 100000:100000 /dev/net/tun
Check the permissions are set correctly:

 # ls -l /dev/net/tun
 crw-rw-rw- 1 100000 100000 10, 200 Dec 22 13:26 /dev/net/tun
Finally start the container:

 # pct start 123
 
As report the official guide it works.. (on the first lxc) .. but which is the correct /dev/net dev/net for others tun devices?


Code:
nano /etc/pve/lxc/123.conf

Add the following lines at the end (if you're using PVE < 7.0, change `cgroup2` with `cgroup`)

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

Press Ctrl-X and answer "Y" for saving and press Enter.

For your unprivileged container to be able to access the /dev/net/tun from your host, you need to set the owner by running:

 # chown 100000:100000 /dev/net/tun
Check the permissions are set correctly:

 # ls -l /dev/net/tun
 crw-rw-rw- 1 100000 100000 10, 200 Dec 22 13:26 /dev/net/tun
Finally start the container:

 # pct start 123

Works for more containers simultaneously too.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!