Configuring Proxmox OpenVPN with /dev/net/tun for LXC Debian running OpenVPN
Proxmox is an open-source server virtualization management solution based on QEMU/KVM and LXC. OpenVPN is a full-featured open-source SSL VPN solution that accommodates a wide range of configurations. In this article, we will discuss how to configure Proxmox OpenVPN with /dev/net/tun for LXC Debian running OpenVPN.
Prerequisites
Before we begin, make sure you have the following:
- A Proxmox server
- A Debian LXC container running OpenVPN
Configuring Proxmox OpenVPN
To configure Proxmox OpenVPN, follow these steps:
- Log in to your Proxmox server.
- Create a new OpenVPN container by clicking on the "Create VM" button.
- Select "LXC" as the type of container, and then select the Debian template.
- Configure the network settings for the container. Make sure to enable the "TAP device" option, and select "/dev/net/tun" as the TAP device.
- Configure the storage settings for the container. You can use a local or remote storage, depending on your setup.
- Configure the other settings for the container, such as the hostname, root password, and network settings.
- Start the container and connect to it via SSH.
Configuring OpenVPN on the Debian Container
To configure OpenVPN on the Debian container, follow these steps:
- Install OpenVPN by running the following command:
apt-get install openvpn- Create a new OpenVPN configuration file by copying the sample configuration file:
cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/server.conf.gz- Unzip the configuration file:
gunzip /etc/openvpn/server.conf.gz- Edit the configuration file:
nano /etc/openvpn/server.confMake sure to configure the following settings:
- ca, cert, and key: The CA, certificate, and key files for the OpenVPN server.
- dh: The Diffie-Hellman parameters file for the OpenVPN server.
- server: The server network configuration for the OpenVPN server.
- push: The settings to push to the OpenVPN clients.
- user and group: The user and group to run the OpenVPN server as.
- Start the OpenVPN server:
systemctl start openvpn@server- Enable the OpenVPN server to start on boot:
systemctl enable openvpn@serverConfiguring Proxmox to Allow /dev/net/tun Devices
To configure Proxmox to allow /dev/net/tun devices, follow these steps:
- Log in to your Proxmox server.
- Edit the LXC container configuration file:
nano /etc/pve/lxc/XXX.confReplace XXX with the ID of your LXC container.
- Add the following lines to the configuration file:
lxc.cgroup2.devices.allow: c10:200rwlxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=fileMake sure to replace XXX with the ID of your LXC container.
In this article, we have discussed how to configure Proxmox OpenVPN with /dev/net/tun for LXC Debian running OpenVPN. We have covered the following key concepts:
- Configuring Proxmox OpenVPN
- Configuring OpenVPN on the Debian container
- Configuring Proxmox to allow /dev/net/tun devices