Great post. I was under the impression that the internal address for Mullvad was not static, thus eliminating the ability for firewall rules. I'll try Mullvad again to verify. How would I create the rules you suggested with Windows' firewall? To my knowledge it does not allow for adapter rules, and t has to be windows' because third party ones suck.
Windows Defender Firewall (WFAS) can do this, but the “per-adapter” control is limited in the GUI. The most reliable way is to use PowerShell, because it supports targeting a specific interface by alias (adapter name). This lets you build a true WireGuard kill switch without depending on a static 10.x tunnel IP.
Important notes before you start
- Do this from local/physical access (not over RDP), because you can lock yourself out.
- Export your current firewall policy first so you can roll back quickly.
- This approach assumes you know the WireGuard server IP/port you connect to (so the tunnel can come up even while everything else is blocked).
1) Backup current firewall rules
Open PowerShell as Administrator:
Code:
netsh advfirewall export "$env:USERPROFILE\Desktop\wf-backup.wfw"
(If you need to restore later: `netsh advfirewall import "path\wf-backup.wfw"`.)
2) Identify your interface aliases (names)
Run:
Code:
Get-NetAdapter | Sort-Object -Property Status,Name | Format-Table -Auto Name,InterfaceDescription,Status
You’re looking for:
- Your WireGuard tunnel adapter alias (often something like “WireGuard Tunnel”, “Mullvad”, “wg-mullvad”, etc.)
- Your non-VPN interfaces (usually “Wi-Fi” and/or “Ethernet”)
For the examples below, I’ll assume:
- WireGuard tunnel alias: WireGuard Tunnel
- Non-VPN aliases: Wi-Fi and Ethernet
Replace those with what you actually have.
3) Create “allow all outbound via WireGuard interface”
This allows normal traffic only if it’s going out through the WireGuard adapter:
Code:
New-NetFirewallRule -DisplayName "WG - Allow outbound on WireGuard interface" `
-Direction Outbound -Action Allow -Enabled True -Profile Any `
-InterfaceAlias "WireGuard Tunnel"
4) Block outbound traffic on non-VPN interfaces (the kill switch)
Because Windows Firewall doesn’t easily do “block everything except this interface”, you typically create explicit block rules on the interfaces you want to prevent leaks on:
Code:
New-NetFirewallRule -DisplayName "WG KillSwitch - Block outbound on Wi-Fi" `
-Direction Outbound -Action Block -Enabled True -Profile Any `
-InterfaceAlias "Wi-Fi"
Code:
New-NetFirewallRule -DisplayName "WG KillSwitch - Block outbound on Ethernet" `
-Direction Outbound -Action Block -Enabled True -Profile Any `
-InterfaceAlias "Ethernet"
At this point, you will likely lose connectivity until you add the next step (allow the WireGuard handshake outside the tunnel).
5) Allow the WireGuard app to reach the VPN server (handshake exception)
You must allow UDP from your normal interface to the VPN server’s public IP and port, otherwise the tunnel can’t establish.
Example (replace the server IP and port, and the WireGuard/Mullvad exe path):
- Mullvad typically uses its own service/exe; WireGuard uses wireguard.exe; some clients use custom binaries.
- Find the exact path from Task Manager > Details > right-click column > “Image path name”, or from the app’s install folder.
Example rule (Mullvad, placeholder path):
Code:
New-NetFirewallRule -DisplayName "WG - Allow Mullvad handshake to server" `
-Direction Outbound -Action Allow -Enabled True -Profile Any `
-InterfaceAlias "Wi-Fi","Ethernet" `
-Protocol UDP -RemoteAddress 203.0.113.10 -RemotePort 51820 `
-Program "C:\Program Files\Mullvad VPN\MullvadVPN.exe"
If your provider rotates server IPs or you switch locations frequently, you’ll need to update (or broaden) the allowed RemoteAddress set accordingly. I can’t safely suggest “allow to any remote address/port” here because that defeats the purpose.
6) DNS leak considerations
If you block all outbound on Wi‑Fi/Ethernet, DNS should also be blocked outside the tunnel (good). Once the tunnel is up, DNS should go via the tunnel.
If you use a local DNS resolver on your LAN intentionally (rare with a VPN kill switch), you’d need to allow that explicitly on the LAN interface, but that also increases leak risk.
About Mullvad’s internal tunnel IP
Mullvad’s tunnel IP is generally stable as long as you keep the same WireGuard key/config (“device”). If you regenerate keys/reinstall/reset the device in the provider/app, the tunnel IP can change. That’s why the interface-based kill switch above is usually the more durable solution.
Conclusion: Windows Defender Firewall can enforce a solid WireGuard kill switch, but it’s best done with interface-alias rules via PowerShell: allow traffic on the WireGuard adapter, block traffic on Wi‑Fi/Ethernet, and add a narrow handshake exception to the VPN server IP/port for the VPN client.