Connect a Proxmox LXC to a VPN Server

Connect a Proxmox LXC to a VPN Server
Photo by Privecstasy / Unsplash

LXC Config

Create your LXC Container using the Debian Template in Proxmox

Once created, don't start it just yet

Go into your Proxmox servers shell

Edit the LXC config file at /etc/pve/lxc/VMID.conf

Add in the following…

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

Change Permissions with this command…

chown 100000:100000 /dev/net/tun

Start your LXC container

Run the rest of the commands on this page inside the LXC container

You'll want to follow either the OpenVPN or Wireguard configuration sections

OpenVPN Configuration

apt update; apt install openvpn

Create a client configuration on your VPN server and copy it to your LXC container

mv *.ovpn /etc/openvpn/client.conf

Enable the autostart service within systemd and start the service

systemctl enable --now [email protected]

This will now automatically reconnect on reboot

Wireguard Configuration

apt update; apt install wireguard

Create a client configuration on your VPN server and copy it to your LXC container

mv *.conf /etc/wireguard/wg0.conf

Enable the autostart service within systemd and start the service

systemctl enable --now wg-quick@wg0

This will now automatically reconnect on reboot