🔷
← All setup guides

Ubiquiti EdgeRouter WireGuard Setup Guide

Manual gateway Works as a gateway for one LAN with no extra steps. Extra VLANs need a few rules added on the device by hand, explained below.

EdgeOS 3.0+ has native WireGuard built-in using a VyOS-style configuration. EdgeOS 2.x requires the community wireguard-vyatta-ubnt package (where PostUp works normally).

1

Create a tunnel in ProxyLink

Go to Devices → + Add → Router / LAN site, select Router / Gateway, enter your LAN subnet, and note all values from the downloaded config. On the gateway page, switch the download picker to 🌐 Router (MikroTik / pfSense / OpenWRT) before clicking Activate, otherwise you get a RouterOS .rsc script instead of a .conf file.

2

Configure WireGuard (EdgeOS 3.x CLI)

configure

set interfaces wireguard wg0 private-key YOUR_PRIVATE_KEY
set interfaces wireguard wg0 address YOUR_VPN_IP/24

set interfaces wireguard wg0 peer SERVER_PUBLIC_KEY endpoint 46.225.153.241:51820
set interfaces wireguard wg0 peer SERVER_PUBLIC_KEY allowed-ips 10.100.0.0/16
set interfaces wireguard wg0 peer SERVER_PUBLIC_KEY persistent-keepalive 25

commit ; save
3

Add NAT masquerade rule

set nat source rule 10 description "ProxyLink masquerade"
set nat source rule 10 outbound-interface br0
set nat source rule 10 source address 10.100.0.0/16
set nat source rule 10 action masquerade
commit ; save
4

Allow forwarding

set firewall name PROXYLINK_IN default-action accept
set interfaces wireguard wg0 firewall in name PROXYLINK_IN
commit ; save

Good to know

EdgeOS 2.x with the community wireguard-vyatta-ubnt package works with standard wg-quick and PostUp lines work normally from the .conf file.
The LAN bridge on EdgeRouter is typically br0. Confirm with: show interfaces bridge.

Reaching more than one VLAN

One LAN needs nothing beyond this guide. If the site has several VLANs (a camera VLAN, a PBX VLAN, a guest network), there is one more thing to know.

ProxyLink gives every gateway its own private address range and translates between that range and your real LAN addresses. That is what lets two different clients both use 192.168.1.0/24 without colliding. The translation rules live in the PostUp and PostDown lines of the config we generate.

Ubiquiti EdgeRouter cannot run those rules for itself, so extra VLANs are routed directly instead of being translated. Two consequences worth knowing:

If a site has several VLANs and you would rather not maintain that by hand, put a small Linux box (a Raspberry Pi is plenty) or a MikroTik beside the router and use it as the gateway. Both are managed, so every VLAN is handled automatically and the existing router is left alone. See the Linux and MikroTik guides.

What you get once the tunnel is up

Ready to connect?

Create a free account and set up your first tunnel in minutes. Free during early access — no card required.

Setup guides for other platforms