WireGuard over IPv6 with a UniFi Dream Machine
Purpose
Make a WireGuard server hosted in Docker (inside a Proxmox LXC container) reachable over both IPv4 and IPv6 behind a UniFi Dream Machine.
Why bother with IPv6? Some networks you connect from, mobile networks in particular, give you an IPv6 address and only reach IPv4 through a shared gateway. Reaching your VPN over IPv6 directly is then simpler and more reliable.
How it works
Internet ── Freebox ── UDM SE ── LAN ── LXC container ── WireGuard
(bridge) IPv4: NAT + port forwarding (Docker)
IPv6: routed + firewall rule
- In bridge mode, the Freebox stops routing: the UDM gets the public IPv4 and the IPv6 prefix itself.
- With SLAAC, every device on the LAN builds its own public IPv6 address from the prefix the UDM advertises.
- IPv6 has no NAT: the container has its own public address. Instead of a port forwarding, you open the WireGuard port to that address in the firewall.
What you need
- a Freebox
- a UniFi Dream Machine (UDM SE here)
- a Proxmox server, with an LXC container running Docker and a WireGuard server (for example the
linuxserver/wireguardimage) listening on UDP port51820
Enable IPv6
Enable bridge mode on the Freebox
- Go to Ma Freebox and select Bridge in Mode réseau
Warning
In bridge mode, the Freebox no longer provides Wi-Fi or DHCP: every device must connect through the UDM.
Enable IPv6 on the UniFi Internet connection
- In UniFi, go to Settings > Internet, select your connection, and in IPv6 Configuration set:
| Setting | Value |
|---|---|
| IPv6 Connection | SLAAC |
| IPv6 Type | Single Network |
| Network | the LAN that receives the prefix (01-LAN-MGMT here) |
- Click on Apply Changes
Enable IPv6 for clients on the network
- Go to
Settings -> Networks -> 01-LAN-MGMT
- In the IPv6 tab, select Manual, then SLAAC as Client Address Assignment
- Keep Router Advertisement (RA) enabled: it is how clients learn the prefix
Success
Check from a computer on this network: https://test-ipv6.com should report an IPv6 address.
Enable IPv6 on the LXC container
- On your Proxmox server, open the Network tab of your container, double-click on
net0and set IPv6 to DHCP
- Click on OK
- Restart the networking service inside the container:
- Run
ip a: you should see your SLAAC IPv6 address
The public address is the one with scope global that starts with your prefix (2a01: with Free). Check that the container reaches the Internet over IPv6:
Expose WireGuard over IPv6
Publish the port on IPv6
Docker publishes ports on all addresses of the host, IPv4 and IPv6, by default. With ports: - "51820:51820/udp" in the docker-compose.yml of WireGuard, check in the LXC container that the port listens on both:
You should see 0.0.0.0:51820 and [::]:51820.
Open the port in the UniFi firewall
For IPv4, keep your usual port forwarding of UDP 51820 to the IPv4 address of the container.
For IPv6, add a firewall rule instead: allow UDP traffic on port 51820 from the Internet to the IPv6 address of the container. In recent UniFi Network versions, this is a policy from the External zone to the Internal zone.
Warning
Open only this port, only to this address. Every device of an IPv6 network has a public address, and the firewall is what protects it.
Make the address easy to reach
An IPv6 address is long to type: create a DNS name for it, with an AAAA record pointing to the container's address (alongside the A record for the IPv4).
Check that the address stays the same after a restart of the container. If it changes, set a static IPv6 address in the container's Network settings in Proxmox, inside your prefix.
Configure the clients
In the client configuration, the Endpoint is the DNS name, or the IPv6 address between square brackets:
Success
From a phone on mobile data, Wi-Fi off, connect to the VPN: on the server, docker exec wireguard wg show shows a recent handshake from an IPv6 address.







