WAN over WireGuard (single NIC + VPS)¶
Scenario: the firewall (for example a Raspberry Pi or a mini-PC) has a single Ethernet port connected to an existing network (for example behind the ISP router). Devices that use fr0ntier as their gateway reach the Internet through a WireGuard tunnel to a VPS, which provides the public IP.
flowchart LR
C[LAN clients<br>gateway = fr0ntier] --> V[fr0ntier port1<br>LAN 192.168.1.2]
V -- "WireGuard wgwan (default route)" --> S[VPS<br>public IP]
V -. "underlay: endpoint route via ISP router" .-> R[ISP router 192.168.1.1] --> I((Internet))
S --> I
1. Install with the wg-wan preset¶
The preset keeps port1 with its current addressing as LAN (HTTPS, SSH, ping, DNS,
NTP allowed), creates zones LAN and WAN, a policy LAN→WAN with NAT, and a
disabled tunnel wgwan with role WAN, default route on and port1 as underlay.
2. Prepare the VPS¶
On the VPS (Debian/Ubuntu):
apt-get install -y wireguard nftables
wg genkey | tee /etc/wireguard/vps.key | wg pubkey > /etc/wireguard/vps.pub
cat >/etc/wireguard/wg0.conf <<CONF
[Interface]
Address = 10.200.0.1/24
ListenPort = 51820
PrivateKey = $(cat /etc/wireguard/vps.key)
PostUp = sysctl -w net.ipv4.ip_forward=1; nft add table ip frnat; nft add chain ip frnat post '{ type nat hook postrouting priority 100; }'; nft add rule ip frnat post oifname "eth0" masquerade
PostDown = nft delete table ip frnat
[Peer]
# fr0ntier
PublicKey = <FR0NTIER-PUBLIC-KEY>
AllowedIPs = 10.200.0.2/32
CONF
systemctl enable --now wg-quick@wg0
(Replace eth0 with the VPS public interface and open UDP 51820 in its provider firewall.)
3. Configure the tunnel in fr0ntier¶
VPN → WireGuard → wgwan:
- Click Generate next to Private key and copy the public key into the VPS
[Peer]section. - Edit the peer
vps: public key of the VPS (cat /etc/wireguard/vps.pub), endpointvps.example.com:51820, allowed IPs0.0.0.0/0, keepalive 25. - Enable the tunnel and commit with confirmation.
fr0ntier installs a host route to the VPS through the underlay (_dhcp4 or the static
gateway of port1) and the default route through wgwan (metric 10). MSS clamping is
enabled by default, so TCP works with the tunnel MTU (1420).
4. Point clients to fr0ntier¶
Set the clients' gateway (and DNS) to the fr0ntier address, statically or with fr0ntier's DHCP server (disable DHCP on the ISP router first).
5. Verify¶
fr0ntier # get router info routing-table all
fr0ntier # diagnose vpn wireguard
fr0ntier # execute ping 9.9.9.9
fr0ntier # diagnose firewall policy-lookup 192.168.1.50 1.1.1.1 tcp 443
Monitoring → VPN status shows the handshake; enable gateway monitoring style
alerts on fr0ntier_wg_peer_up.
Reverse direction
To publish a LAN service through the VPS, add a DNAT on the VPS to 10.200.0.2
and a port forward on fr0ntier from wgwan to the internal host.