VPNSmith
self-host-vpnINFO

WireGuard on Proxmox: Host, VM or LXC, and Why the Container Route Bites

Three places to run WireGuard on a Proxmox box, and they are not equivalent. The host is simplest, a VM is cleanest, and an LXC container needs TUN passed through before wg-quick will even start. What each one costs you.

By Eric Gerard · Founder · VPNSmith - Self-host VPN & GDPR VPS specialist4 min readPhoto via Pexels

Affiliate disclosure - This post contains Contabo affiliate links. If you grab a VPS through them, we earn a commission at no extra cost to you.

Proxmox gives you three plausible homes for a WireGuard tunnel, and every guide picks one without saying why. The choice matters, because two of them fail in ways that are hard to read the first time.

The three options, and what each one actually costs

On the host. One apt install wireguard, one config, done. It is the fastest route and the one most people take.

The cost is that your VPN and your hypervisor management plane are now the same machine and the same firewall. A mistake in a PostUp rule does not break a service, it locks you out of the box that runs every other service. If you do this, keep IPMI, a console, or physical access available.

There is one case where it is the right answer anyway: when the reason for the tunnel is to reach the Proxmox web interface at port 8006 from outside. A tunnel that terminates inside a VM cannot help you when the VM is down.

In a VM. A small Debian guest with 512 MB of RAM handles a home tunnel without noticing. The isolation is real, snapshots work, and a broken firewall rule costs you one guest rather than the host.

The cost is a little overhead and one more system to patch. For most setups this is the right default.

In an LXC container. Cheapest in resources, and the one that produces the confusing failure described below.

Rows of network line cards seen from an angle in a dark rack, dozens of small bright green link lights repeating across dark blue and grey panels, the foreground rows sharp and the upper rows fading out of focus
Rows of network line cards seen from an angle in a dark rack, dozens of small bright green link lights repeating across dark blue and grey panels, the foreground rows sharp and the upper rows fading out of focus

The LXC failure, and the fix

Install WireGuard in a fresh unprivileged container, run wg-quick up wg0, and you get an error about a TUN device rather than about your config. The config is fine. The container has no /dev/net/tun, because unprivileged containers do not get device nodes they were not given.

Shut the container down, then edit /etc/pve/lxc/<CTID>.conf on the host and add:

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

Start it again and wg-quick up wg0 works. Check the device arrived with ls -l /dev/net/tun inside the container.

Do not make the container privileged to solve this. It works, and it hands the container a level of access the problem never required. The two lines above are the whole fix.

One more thing that catches people out: the kernel module lives on the host, not in the container. Proxmox ships a kernel with WireGuard built in, so there is normally nothing to load, but if wg complains about a missing module, that is a host problem and installing packages inside the container will not touch it.

Routing your other guests through the tunnel

Once the tunnel is up, you usually want more than the machine holding it to use it.

On the machine running WireGuard, enable forwarding:

sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf

Then, on the peer at the far end, list the local subnets in AllowedIPs so return traffic knows where to go:

[Peer]
PublicKey = <peer public key>
AllowedIPs = 10.10.0.2/32, 192.168.10.0/24

AllowedIPs is doing two different jobs at once here, which is the single most common source of confusion with WireGuard. On the sending side it is a routing table, and on the receiving side it is an access control list. Getting it wrong produces silence rather than an error. The detail is in our AllowedIPs guide.

If the tunnel comes up and traffic then stalls, the next suspect is packet size rather than routing: see WireGuard MTU. If the handshake never completes at all, start with handshake troubleshooting.

Firewall, briefly

Proxmox has its own firewall layer at datacenter, node and guest level, and it sits in front of anything you configure inside a guest. A rule that works when you test it from the host can be dropped before it reaches the container.

If a tunnel refuses connections and the config looks right, check the Proxmox firewall at all three levels before rewriting anything in wg0.conf.

Which one to pick

If the tunnel exists to reach your Proxmox management interface from outside, put it on the host and accept the coupling.

For everything else, a small VM is the boring correct answer, and an LXC container is fine once TUN is passed through. Both keep the hypervisor out of the blast radius, which is the property you will care about the day a rule is wrong.

If you do not have a machine to host the far end of the tunnel, a small VPS is the usual answer: our cheapest VPS for WireGuard comparison covers what the low tiers actually deliver.

★ Nuremberg GDPR datacenter · ✓ Dedicated IPv4 included · 200+ Mbps guaranteed

Self-host your VPN on your own VPS → ContaboFull root access · public IPv4 · pick your region

Frequently asked questions

Should I run WireGuard on the Proxmox host or in a VM?
Run it in a VM or container if the tunnel is a service for your network, and on the host only if you need to reach the Proxmox web interface itself when everything else is down. Installing on the host mixes your management plane with a service, so a bad firewall rule can lock you out of the machine that runs everything.
Why does wg-quick fail in a Proxmox LXC container?
An unprivileged LXC container has no access to /dev/net/tun by default, and WireGuard needs it. The container must be given the TUN device through its configuration file before wg-quick up will work. The usual error mentions that it cannot open a TUN device or that the operation is not permitted.
Does WireGuard need a privileged container on Proxmox?
No. An unprivileged container works once /dev/net/tun is passed through with the right cgroup and mount entries. Making the container privileged also solves it, and gives away far more than the problem required.
Can one WireGuard instance serve several Proxmox VMs?
Yes, and that is usually the better layout. Run one WireGuard endpoint, route the subnets your VMs live on through it with AllowedIPs, and enable IP forwarding on the machine holding the tunnel.