To configure Mullvad VPN on OPNsense with split tunneling, you create a WireGuard tunnel interface using Mullvad's configuration generator, assign it a gateway, then use OPNsense's policy-based routing to selectively send specific LAN clients or traffic types through the VPN while leaving everything else on your regular ISP connection. The entire setup takes roughly 45–60 minutes if you've worked in OPNsense before.
Prerequisites / What You'll Need
- OPNsense 24.7 or later (this guide was tested on 24.7.9)
- Mullvad account with an active subscription ($5.00/month, billed monthly; or $60.00/year — no trial, no free tier)
- Mullvad WireGuard config downloaded from
account.mullvad.net→ Devices → Generate Config - OPNsense admin access via browser (
192.168.1.1or your LAN IP) - The
os-wireguardplugin installed in OPNsense (VPN → WireGuard — if the menu exists, it's already there) - A list of LAN IP addresses or a subnet you want to route through the VPN
- Basic familiarity with OPNsense firewall rules and aliases
Step 1: Generate Your Mullvad WireGuard Configuration
Log in at account.mullvad.net. Navigate to Devices → Generate WireGuard config. Select:
- Platform: Linux (this gives you a raw
[Interface]/[Peer]config you can parse) - Server location: Pick your preferred exit country and city (e.g.,
se-got-wg-001for Gothenburg, Sweden) - Port: 51820 (UDP) is Mullvad's standard WireGuard port; 51820–51823 all work
Download the .conf file. Open it in a text editor. You'll see something like:
[Interface]
PrivateKey = <your-private-key>
Address = 10.68.x.x/32
DNS = 10.64.0.1
[Peer]
PublicKey = <mullvad-server-public-key>
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 193.138.x.x:51820
Keep this file open — you'll paste values from it directly into OPNsense. The PrivateKey is your client key (never share it). The PublicKey under [Peer] is Mullvad's server public key. The Endpoint IP is the specific relay server address.
Step 2: Install the WireGuard Plugin (If Not Already Present)
In OPNsense, go to System → Firmware → Plugins. Search for os-wireguard. Click the + icon to install. After installation, go to VPN → WireGuard — if the menu renders, the plugin is active. No reboot required in OPNsense 24.7.
Common gotcha: If you don't see VPN → WireGuard after installation, go to System → Firmware → Plugins and confirm the plugin shows as installed (green check). Sometimes a browser cache refresh (Ctrl+Shift+R) is needed.
Step 3: Create the WireGuard Local Instance (Client)
Go to VPN → WireGuard → Local. Click + to add a new instance.
- Name:
mullvad(or any label you'll recognize) - Public Key: Click Generate — OPNsense generates a keypair. Copy the public key — you'll need it in Step 4 if you pre-register devices, but for Mullvad's config-file method, you already have a private key from the downloaded config.
- Private Key: Paste the
PrivateKeyvalue from your Mullvad.conffile - Listen Port: Leave blank (OPNsense picks a random outbound port as a client)
- Tunnel Address: Paste the
Addressvalue (e.g.,10.68.45.123/32) - DNS Server: You can enter
10.64.0.1(Mullvad's internal DNS) here, but for LAN clients the DNS handled by OPNsense's resolver is usually preferred — leave this blank and control DNS at the resolver level
Click Save.
Step 4: Add the Mullvad Server as a WireGuard Peer (Endpoint)
Go to VPN → WireGuard → Endpoints. Click +.
- Name:
mullvad-se-got(or your server name) - Public Key: Paste the
PublicKeyfrom the[Peer]section of your.conf - Allowed IPs:
0.0.0.0/0— this tells WireGuard to route all traffic through the peer; OPNsense firewall rules, not WireGuard's AllowedIPs, will control what actually uses the tunnel - Endpoint Address: The IP from
Endpoint(e.g.,193.138.219.228) - Endpoint Port:
51820 - Instance: Select the
mullvadlocal instance you created in Step 3
Click Save, then go back to VPN → WireGuard → Local, edit your mullvad instance, and confirm the peer is listed under Peers.
Enable WireGuard by toggling VPN → WireGuard → General → Enable WireGuard to on.
Step 5: Assign the WireGuard Interface
Go to Interfaces → Assignments. In the dropdown next to New interface, find wg0 (or whichever WireGuard device was created). Click + to assign it.
Go to Interfaces → [WGMULLVAD] (or whatever name OPNsense assigned):
- Enable interface: checked
- Description:
WGMULLVAD - IPv4 Configuration Type: None (the tunnel address is configured on the WireGuard instance itself)
Click Save and Apply.
Step 6: Create the Mullvad VPN Gateway
Go to System → Gateways → Configuration. Click +.
- Name:
MULLVAD_GW - Interface:
WGMULLVAD - Address Family: IPv4
- IP Address:
10.64.0.1(Mullvad's gateway — the first usable IP on their WireGuard subnet; use the DNS IP as the gateway monitor address) - Far Gateway: checked (required because the gateway is not on the same subnet)
- Disable Gateway Monitoring: optionally check this — Mullvad's relay IPs don't respond to ICMP, so monitoring will show "down" even when working. If you want monitoring, Mullvad provides specific ping addresses in their docs.
Click Save and Apply.
Common gotcha: If you leave gateway monitoring enabled with an unresponsive IP, OPNsense may refuse to use the gateway. Either disable monitoring or use 10.64.0.1 as the monitor IP and ensure the WireGuard tunnel is up first.
Step 7: Create a Split-Tunnel Alias for Target Devices
Go to Firewall → Aliases. Click +.
- Name:
VPN_Clients - Type: Host(s)
- Content: Add the LAN IP addresses of devices you want routed through Mullvad (e.g.,
192.168.1.100,192.168.1.101)
Alternatively, set Type to Network and enter a subnet like 192.168.10.0/24 if you've put VPN-bound devices on a dedicated VLAN.
Click Save and Apply.
Step 8: Write the Firewall Rules for Split Tunneling
Go to Firewall → Rules → LAN. Click + to add a rule above the default LAN-to-any pass rule.
- Action: Pass
- Interface: LAN
- Protocol: Any
- Source: Single host or alias →
VPN_Clients - Destination: Any
- Gateway:
MULLVAD_GW - Description:
Route VPN_Clients through Mullvad
Click Save. Make sure this rule sits above the default allow-all LAN rule in the list (drag it if necessary). Click Apply Changes.
Devices not in the VPN_Clients alias will hit the default rule, which uses the WAN gateway — that's your split tunnel.
Step 9: Handle DNS Leak Prevention
Go to Services → Unbound DNS → General. Under Network Interfaces, verify only your LAN (and optional VLAN) interfaces are bound — not WGMULLVAD. Then go to Firewall → Rules → WGMULLVAD and add a rule blocking DNS (port 53 TCP/UDP) to any destination except 10.64.0.1 to prevent DNS leaks from VPN clients reaching your ISP's resolver.
Verification — Confirming the Tunnel Works
- WireGuard status: Go to VPN → WireGuard → Status. You should see your peer listed with a non-zero Latest Handshake timestamp (refreshes every ~180 seconds when traffic flows). A handshake time of "never" means the tunnel isn't up — go back to Step 4 and verify the endpoint IP and public key.
- From a VPN-bound device: Visit
mullvad.net/checkin a browser. You should see "You are connected to Mullvad" with the Swedish (or your chosen) exit IP shown. The page also displays a DNS leak check — all DNS servers listed should be Mullvad's.
- From a non-VPN device: Visit
ipleak.net. Your ISP's public IP should appear, confirming that device is using the regular WAN.
- Gateway status in OPNsense: Go to System → Gateways → Status.
MULLVAD_GWmay show "Pending" if monitoring is on and ICMP is blocked — that's expected behavior. If it shows "Down" and traffic isn't passing, disable monitoring temporarily and test.
Recommended Tools to Complement This Setup
If you're running OPNsense as your household or office edge router and want a VPN provider that offers strong privacy guarantees for other devices — laptops, phones — that may leave the network, NordVPN is worth considering alongside Mullvad (not instead of it).
NordVPN supports WireGuard (via its NordLynx protocol, using ChaCha20 encryption with Curve25519 key exchange), is headquartered in Panama (outside 5/9/14 Eyes), and was audited by Deloitte in 2023 for its no-logs policy. Apps run on Windows, macOS, Linux, iOS, Android, and browser extensions for Chrome and Firefox. Pricing is $3.09/user/month on the 2-year Standard plan, $4.49/user/month on the Plus plan (adds a password manager and data breach scanner), and $5.99/user/month on the Ultimate plan (adds 1 TB encrypted cloud storage). MFA is supported via TOTP authenticator apps.
The practical use case here: OPNsense handles your always-on Mullvad split tunnel for home automation hubs and media servers, while NordVPN covers your team's mobile devices with its own split-tunneling app feature on Android and iOS. If you're also evaluating VPNs for a business context, our Best VPN for Small Business Employees in 2026 guide compares NordVPN against other team-oriented options with seat-based pricing.
Try NordVPN — solid choice for mobile and remote workers alongside your OPNsense/Mullvad perimeter setup.
Troubleshooting
Issue 1: WireGuard handshake never completes
Symptom: VPN → WireGuard → Status shows "Latest Handshake: Never"
Fix: Confirm the endpoint IP is reachable from your WAN. Run ping 193.138.x.x from the OPNsense shell (Diagnostics → Execute Command). If it doesn't respond (ICMP blocked by Mullvad is normal), use nc -zvu 193.138.x.x 51820 to test UDP reachability. Also verify your ISP doesn't block outbound UDP 51820 — try port 51821 or 51822 from Mullvad's server list.
Issue 2: All traffic goes through the VPN, not just VPN_Clients
Symptom: Devices not in the alias are also showing Mullvad's exit IP
Fix: Check your firewall rule order under Firewall → Rules → LAN. The Mullvad rule may be below the default allow-all, meaning OPNsense isn't evaluating it first. Drag the Mullvad rule to the top of the LAN ruleset. OPNsense processes rules top-to-bottom, first match wins.
Issue 3: DNS leaks — ISP resolver appearing in leak test
Symptom: mullvad.net/check shows your ISP's DNS servers
Fix: Add a firewall rule on the LAN interface blocking outbound DNS (TCP/UDP port 53) for the VPN_Clients alias to any destination except 10.64.0.1. This forces VPN-bound clients to use Mullvad's resolver. Also disable DNS rebinding protection in Unbound if Mullvad's DNS responses are being dropped.
Issue 4: Gateway shows "Down" and traffic doesn't pass
Symptom: System → Gateways → Status shows MULLVAD_GW as Down, VPN clients have no internet
Fix: Edit the gateway and check Disable Gateway Monitoring, then save and apply. Mullvad's tunnel IPs don't respond to ICMP probes, so the gateway monitor incorrectly marks it offline. With monitoring disabled, OPNsense assumes the gateway is up and routes traffic through it normally.
Issue 5: IPv6 traffic leaking outside the tunnel
Symptom: IPv6 addresses appear on ipleak.net for VPN-bound devices
Fix: Either disable IPv6 on your LAN interface for the affected VLAN, or add a firewall rule on LAN blocking all IPv6 traffic from VPN_Clients to any (effectively forcing those devices onto IPv4-only through the tunnel). Mullvad supports IPv6 through the tunnel, but OPNsense's WireGuard setup requires explicit IPv6 AllowedIPs and tunnel address configuration to handle it correctly.
FAQ
Does Mullvad VPN support split tunneling natively on its desktop app?
Mullvad's desktop app for Windows, macOS, and Linux includes a built-in split tunneling feature that lets you exclude specific applications from the VPN tunnel. On Windows and Linux