You Already Own the VPN Server
You’re at a coffee shop and you need your NAS, your Home Assistant dashboard, or just a DNS server that doesn’t lie to you. The usual answer is a separate VPN box: a Raspberry Pi, a container, a second thing to patch. You already run a firewall that sits on the edge of your network and decides what comes in. Putting the VPN on that firewall is the shorter path.
OPNsense ships WireGuard in the base system. You make one instance, add a peer per device, open one UDP port, and you’re done. The second decision is how much traffic the client sends home: only home-bound traffic (split tunnel) or everything (full tunnel). Both need the same firewall setup, and full tunnel adds one NAT check.
As of December 2026, I checked the official road warrior how-to against the OPNsense 26.7 series (26.7.10 was the newest 26.7 release in the changelog, dated November 24, 2026). Menu names below match that documentation.
Do You Need a Plugin?
No. WireGuard moved into core with OPNsense 24.1, whose changelog lists the “core inclusion of the os-firewall and os-wireguard plugins”. If a tutorial tells you to install os-wireguard, it’s from before that. On a current install, go to VPN > WireGuard and the menu is already there.
Three terms matter in the UI:
- Instance: the server side. It has the listen port, the tunnel address, and the keypair.
- Peer: one client device (a laptop, a phone).
- Peer generator: a helper under VPN > WireGuard > Peer generator that builds a client config and QR code for you. More on it below.
Pick Your Tunnel Shape First
Decide this before you touch a config, because it changes what you build on the firewall.
Split tunnel sends only traffic for your home networks through WireGuard. The phone’s web browsing stays on the local connection. You get access to your LAN and nothing else changes. This is the right default for most people. It’s cheap on bandwidth and nothing breaks when the VPN is down.
Full tunnel sends everything through home. Use it on hostile networks (hotel, airport, conference wifi), or when you want your home IP and your home DNS filtering everywhere. Your home upload speed becomes the ceiling for everything the client does.
The difference lives in one line of the client config: AllowedIPs. The firewall side needs a bit more work for full tunnel (NAT), and I’ll mark where.
I’ll use these example values throughout:
| Item | Value |
|---|---|
| Public endpoint | vpn.example.com |
| Tunnel subnet | 10.10.10.0/24 |
| OPNsense tunnel address | 10.10.10.1 |
| Home LAN | 192.168.1.0/24 |
| Listen port | 51820 |
Step 1: Create the Instance
Go to VPN > WireGuard > Instances and click +. Set these fields and leave everything else at the default:
| Field | Value |
|---|---|
| Enabled | Checked |
| Name | HomeWireGuard |
| Public Key / Private Key | Click the cogwheel to generate both |
| Listen Port | 51820 (or a higher unique port) |
| MTU | 1420 (default), or 1412 if your WAN uses PPPoE |
| Tunnel Address | 10.10.10.1/24 |
| Peers | Leave empty for now |
| Disable Routes | Unchecked |
Two gotchas from the docs. First, the tunnel address must be in CIDR notation and must be a subnet nothing else on your network uses. Do not use a /32. Second, leave the DNS Server field (visible in advanced mode) blank on the instance. Filling it in makes WireGuard overwrite OPNsense’s own DNS configuration, which is a fun way to lose your afternoon.
Save, then save again to apply. Re-open the instance and copy the public key. The clients need it.
Step 2: Add Peers (Two Ways)
The manual way
Generate the client keypair on the client:
umask 077wg genkey | tee private.key | wg pubkey > public.keycat public.keyThen in VPN > WireGuard > Peers, click +:
| Field | Value |
|---|---|
| Enabled | Checked |
| Name | Laptop |
| Public Key | Contents of the client’s public.key |
| Allowed IPs | 10.10.10.2/32 |
Note that Allowed IPs on the OPNsense peer is the client’s own tunnel address, a single /32. It is not the list of networks the client may reach. Get it wrong and OPNsense drops the client’s packets without a word, a common cause of “handshake works, nothing passes.”
Save the peer and click Apply. Go back to Instances, open HomeWireGuard, pick the peer in the Peers dropdown, then save and apply again. Repeat for each device, using 10.10.10.3/32, 10.10.10.4/32, and so on.
The peer generator
For phones, the generator saves time. It lives at VPN > WireGuard > Peer generator. You pick the instance, and it derives client addresses from the instance’s network, gives the peer a keypair, and shows the finished client config plus a QR code you scan with the mobile app. It also remembers the endpoint, DNS servers, and allowed IPs from the instance as defaults for the next peer.
Per the docs, it stores only the public key on the firewall by default. Storing the client’s private key is an option that is off by default. Leave it off. A private key that never leaves the device can’t leak from a firewall backup.
One warning from the docs: the generator calculates the next address before it saves the peer, so creating several peers at once can propose the same address twice. Make them one at a time.
If you want DNS to work through Unbound with the generator, the docs say to put the tunnel address (10.10.10.1) in its DNS server field.
Step 3: Turn WireGuard On
Go to VPN > WireGuard > General, check Enable WireGuard, and click Apply. If it was already on, toggle it off, apply, then on and apply again to restart it. You’ll do this restart a few more times in the next steps. It’s the cheapest fix for “I changed something and nothing happened.”
Step 4: Assign an Interface
The docs call this optional for a road warrior but recommend it, and I agree. Skip it and you end up writing firewall rules on the auto-created WireGuard group with a hand-made alias for the tunnel subnet. Assign it and you get a HomeWireGuard net alias, its own rule tab, and an automatic IPv4 outbound NAT rule for the tunnel.
Go to Interfaces > Assignments, click Add, pick the WireGuard device (wg1 if it’s your first), and set:
| Field | Value |
|---|---|
| Enabled | Checked |
| Lock | Checked |
| Description | HomeWireGuard |
| IPv4 Configuration Type | None |
| IPv6 Configuration Type | None |
Don’t put an IP on the interface. OPNsense adds the tunnel address from the instance once WireGuard restarts. Save, apply, then restart WireGuard from the General page again.
If your Unbound DNS listens on all interfaces, it needs a reload before it notices the new interface. The docs list that reload as the step that gets DNS working for tunnel clients.
Step 5: Firewall Rules
Two pass rules, then MSS clamping. Skip either pass rule and nothing works, and the failure looks different for each.
Rule 1: let the handshake in
Firewall > Rules > WAN, click Add:
| Field | Value |
|---|---|
| Action | Pass |
| Quick | Checked |
| Interface | WAN |
| Direction | in |
| TCP/IP Version | IPv4 (or IPv4+IPv6) |
| Protocol | UDP |
| Source | any |
| Destination | WAN address |
| Destination port range | 51820 (your listen port) |
If this rule is missing or the port is wrong, there is no handshake at all. The client just sits there sending packets into nothing.
Rule 2: let the tunnel reach something
Firewall > Rules > HomeWireGuard, click Add:
| Field | Value |
|---|---|
| Action | Pass |
| Quick | Checked |
| Direction | in |
| Protocol | any |
| Source | HomeWireGuard net |
| Destination | any, or specific subnets and hosts |
The destination is your access policy. any is simple. If your phone only needs one NAS, put the NAS address there. This is where road warrior beats a flat “VPN gives you everything” setup: you can scope each tunnel to what it needs.
Rule 3: clamp the MSS
The docs also add normalization rules so TCP sessions don’t stall on fragmentation. Go to Firewall > Settings > Normalization, click +, and set Interface to WireGuard (Group), Direction Any, Protocol any, with Max mss 1380 (use 1372 with PPPoE). That covers IPv4. If IPv6 also passes through the tunnel, add a second rule with the same settings and Max mss 1360 (1352 with PPPoE). The docs warn that without clamping, ping and UDP work while some encrypted TCP sessions refuse to.
Step 6: Outbound NAT (Full Tunnel Only)
For a split tunnel to your LAN, you can skip this step. For a full tunnel, client packets headed to the internet leave through WAN, so the tunnel subnet needs source NAT.
If you did Step 4, the docs say OPNsense adds an IPv4 source NAT rule for you. Confirm it exists under Firewall > NAT > Source NAT (Outbound). Automatic and Hybrid rule generation both create it; only Manual mode leaves it out. IPv6 is different: NAT is only needed if your tunnel uses ULA addresses, and not for globally routable ones.
If you skipped the interface assignment, add the rule yourself. On Firewall > NAT > Source NAT (Outbound), select Hybrid rule generation, then save and apply. Add a rule with Interface WAN, TCP/IP Version IPv4, Source your tunnel subnet (10.10.10.0/24 or an alias), Destination any, Translation Interface address. Save, apply, and restart WireGuard.
Step 7: The Client Config
The split-tunnel version for a Linux laptop looks like this. Save it as /etc/wireguard/wg0.conf:
[Interface]PrivateKey = <client-private-key>Address = 10.10.10.2/32DNS = 10.10.10.1
[Peer]PublicKey = <server-public-key>Endpoint = vpn.example.com:51820AllowedIPs = 10.10.10.0/24, 192.168.1.0/24PersistentKeepalive = 25On the client, AllowedIPs is the routing table: only traffic for those subnets goes into the tunnel. DNS = 10.10.10.1 points the client at Unbound on the firewall, and the docs remind you that DNS servers reachable over the tunnel must be covered by AllowedIPs (the 10.10.10.0/24 entry does that here).
For a full tunnel, change one line:
AllowedIPs = 0.0.0.0/0, ::/0Now all IPv4 and IPv6 traffic goes home. If your tunnel is IPv4 only and you route ::/0 anyway, IPv6 traffic goes into the tunnel and dies there. Either give the tunnel IPv6 addresses or use 0.0.0.0/0 alone.
PersistentKeepalive = 25 sends a packet every 25 seconds so NAT mappings on the client’s network don’t expire. Phones behind carrier NAT need it. A laptop on a stable network can live without it.
Bring it up and look:
sudo wg-quick up wg0ping -c 3 10.10.10.1sudo wg showA healthy wg show has a latest handshake line a few seconds old and nonzero transfer counters. You can also check the server side under VPN > WireGuard > Status, which lists instances, peers, and their last known handshake.
Phones: Scan a QR Code
For a phone, write the same config with that phone’s own key and address (10.10.10.3/32), then render it as a QR code and scan it from the WireGuard app’s “add tunnel” option:
qrencode -t ansiutf8 < phone.confOr skip the file entirely and use the peer generator, which shows the QR code in the UI. Either way, treat the QR code like a password. Anyone who photographs it gets your tunnel.
When It Doesn’t Work
Match the symptom to the layer:
- No handshake. The packet never reached the instance or the keys don’t match. Check the WAN rule and port, check that the endpoint resolves to your real public IP, and compare the public keys on both sides. Make sure WireGuard is enabled and you restarted it after changes.
- Handshake, but no traffic. The tunnel is fine and something above it isn’t. Check that the OPNsense peer’s Allowed IPs is the client’s
/32, that the client’sAllowedIPsincludes where you’re going, and that theHomeWireGuardrule passes the traffic. - LAN works, internet doesn’t (full tunnel). Outbound NAT is missing or the client’s
AllowedIPslacks0.0.0.0/0. - IPs work, names don’t. Unbound isn’t listening on the WireGuard interface (reload it), or the client’s
DNSpoints somewhere outside the tunnel’s reach. - Pings work, some websites hang. MTU or MSS. Add the normalization rules from Step 5.
The SumGuy Take
Run split tunnel by default and keep a second, full-tunnel profile on the phone for sketchy wifi. One firewall, two profiles, and you toggle in the app. Give each device its own peer so you can revoke a lost phone without touching your laptop. Scope the HomeWireGuard rule to the services you use instead of any, because a stolen phone with any is a stolen foothold in your whole LAN.
Using the firewall for this is like using the forklift already parked in the warehouse instead of renting a second one. It’s already there, it already knows the building, and it doesn’t need its own parking space.
Common Questions
Does OPNsense need a plugin for WireGuard?
No. WireGuard became part of OPNsense core in version 24.1, which absorbed the os-wireguard plugin. On a current release, you find it under VPN > WireGuard with nothing to install.
Can I use WireGuard on OPNsense behind CGNAT?
Not for incoming connections. Clients connect to an endpoint that must be reachable from the internet, and carrier-grade NAT blocks inbound UDP to your WAN. Ask your ISP for a public address, or use IPv6 if your ISP gives you a routable prefix. The WAN firewall rule cannot help if packets never reach the box.
What is the difference between an Instance and a Peer in OPNsense?
An instance is the server side: it holds the listen port, the tunnel address, and the firewall’s keypair. A peer is one client device with its own public key and a single /32 tunnel address. You create a peer per device, then attach each peer to the instance in the instance’s Peers dropdown. One instance can serve every road warrior device you own, so a second instance only makes sense for a separate tunnel with different rules.
Should I store the client private key on the firewall?
No. The peer generator can store it, but that option is off by default, and the OPNsense documentation says the key normally belongs only on the client device. Storing it lets you rebuild a client config and QR code later, at the cost of keeping that private key in the firewall configuration.
How do I undo this setup?
Open VPN > WireGuard > General, uncheck Enable WireGuard, and click Apply to stop the tunnel. Then disable the WAN rule for the listen port. Your instance, peers, and keys stay saved, so turning the VPN back on is one checkbox. For a full removal, also delete the interface assignment, the WireGuard rules, the MSS normalization rules, and any manual source NAT rule.