Stockio

VPN Kill Switch on macOS and Windows: Firewall vs App

Configure and test a VPN kill switch on Windows and macOS, compare app controls with native filtering, and catch IPv6, DNS, and disconnect leaks.

By Ravi Desai

DevOps & Security Engineer ·

On this page

A VPN can disconnect while your browser, backup client, and chat applications keep sending traffic. A kill switch should make that failure boring: connections stop instead of silently moving to an unencrypted route.

This guide separates application settings from operating-system enforcement, shows how to inspect Windows and macOS networking, and gives you a repeatable failure test. Work locally on a personal computer, not through a remote session that your firewall changes could disconnect.

Define what must stop and what may continue

Start with a default-deny goal: internet traffic must use the tunnel, even when the VPN application crashes. Decide separately whether local network access remains available. Printing, router administration, and NAS backups are exceptions, not evidence that a kill switch failed.

Use the Subnet & CIDR Calculator below to check the precise network behind an exception. Enter your actual LAN prefix, then test your printer's address for membership. An exception for a whole private address block is much broader than an exception for one home subnet.

Write down four items before changing anything: the physical interface, tunnel interface, VPN endpoint, and allowed local destinations. Include IPv6 coverage in that inventory. Blocking IPv4 while leaving IPv6 unrestricted does not create a complete policy. Corporate endpoint software can also enforce rules you cannot safely override; ask the administrator rather than trying to bypass them.

Prefer an app switch when it enforces the right policy

A good application switch installs persistent filtering, not merely a disconnect callback. Look for settings such as “block connections without VPN,” “always-on,” or a separately labeled advanced kill switch. Names vary, so verify behavior instead of trusting the label.

Distinguish a session-only switch from a policy that also blocks traffic before login or after quitting the application. Some products deliberately restore connectivity when the user selects Disconnect. That behavior may be convenient, but it does not meet a strict always-on requirement.

  1. Enable the strongest documented blocking mode available.
  2. Disable local-network exceptions unless you need them.
  3. Confirm whether the setting covers IPv6 and DNS.
  4. Record how to recover connectivity if the client cannot reconnect.

For background on the actual tunnel, consult the WireGuard quick start. Tunnel encryption and firewall enforcement solve different problems: a valid handshake does not prove unrelated traffic cannot leave another interface.

Application-managed filtering is often safer for roaming laptops because it can follow endpoint changes and interface recreation. Native policies offer independent enforcement, but you become responsible for maintaining those moving parts across updates and new networks.

Inspect Windows rules before enforcing a default deny

Windows Defender Firewall supports outbound defaults and explicit allow rules. It also has an important precedence rule: an explicit block normally overrides an allow. Do not create a blanket outbound block and expect a tunnel allow rule to defeat it.

Open an elevated PowerShell window and collect a baseline snapshot. These commands inspect state and export a rollback file; they do not install a universal kill switch.

New-Item -ItemType Directory -Force C:VPN-Test | Out-Null
netsh advfirewall export "C:VPN-Testefore.wfw"
Get-NetAdapter | Format-Table Name, InterfaceDescription, Status
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultOutboundAction
Get-NetFirewallRule -Enabled True -Direction Outbound -Action Allow |
Select-Object DisplayName, Profile, PolicyStoreSourceType

A default outbound block only blocks traffic without a matching allow. Existing broad application rules can still permit physical-interface traffic. Review those rules, including centrally managed policy, before claiming leak prevention. Microsoft's Windows security documentation explains the platform's firewall and policy model.

A complete design needs scoped allows for the VPN transport to its actual endpoint and port, traffic on the tunnel interface, and any necessary DHCP or local services. Endpoint hostname resolution creates another dependency: allowing unrestricted DNS just to bootstrap a connection weakens a DNS-blocking goal. Prefer the provider's supported implementation when endpoint rotation makes a static policy fragile.

Keep rollback access local. To restore the exported policy, use an elevated terminal with the command below. Importing replaces policy configuration and may affect unrelated rules, so use your own recent backup rather than a file copied from another machine.

netsh advfirewall import "C:VPN-Testefore.wfw"

Understand the macOS firewall boundary

The macOS graphical application firewall is primarily about incoming connections. Turning it on does not create an outbound VPN kill switch. Likewise, denying an application permission to receive connections does not necessarily prevent its outgoing requests.

For outbound enforcement, a VPN application may use platform networking facilities; advanced administrators can also manage PF packet filtering. Read the locally installed manuals before adapting internet examples, because Apple's PF integration and system anchors matter. The Apple support site documents supported Mac networking and security settings.

Inspect interfaces and PF status without replacing the system ruleset:

ifconfig
netstat -rn
sudo pfctl -s info
sudo pfctl -sr
man pf.conf

Do not paste a Linux firewall recipe into macOS. Tunnel names such as utun4 can change, and a rule tied to yesterday's interface can either block everything or allow the wrong path. Loading an entire replacement ruleset can also disrupt operating-system features or other security software.

If you maintain PF yourself, use a managed anchor, documented activation procedure, and tested rollback. Account for DHCP, IPv6 neighbor discovery, the VPN endpoint, and DNS bootstrap explicitly. There is no short static configuration that is safe for every commercial client, roaming interface, and macOS release. For most personal laptops, a tested client-managed switch is the more maintainable choice.

Test failure, not just successful connection

Run tests with fresh connections so cached pages do not hide failures. Use a controlled HTTPS endpoint you operate and watch whether new requests succeed. Check both IP families on a network that actually provides IPv6; an unavailable IPv6 route is not proof of filtering.

Test ordinary disconnect, application exit, forced process termination, sleep and wake, switching Wi-Fi networks, and reboot before the application starts. A single successful test establishes only that one transition worked. Keep test evidence: connection state, physical interface, observed public address, and whether DNS queries escaped.

Check local exceptions with the subnet membership tool again after moving networks. A hotel LAN and your home LAN may use overlapping prefixes. For resolver-specific investigation, follow the Linux DNS leak troubleshooting guide for the conceptual distinction between routing and resolver selection, adapting diagnostics to your operating system.

A kill switch limits accidental routing exposure; it does not make logged-in accounts anonymous or stop browser tracking. Treat privacy scope as a separate decision from transport protection.

Key takeaways

  • Define allowed exceptions before changing firewall policy, including local devices and endpoint bootstrap traffic.
  • Prefer persistent app enforcement when it survives disconnects, crashes, and startup tests.
  • Windows outbound defaults require auditing existing allows; a blanket explicit block defeats narrower allows.
  • The macOS application firewall is not an outbound kill switch, and PF requires careful system integration.
  • Test both address families, DNS behavior, and multiple failure transitions before trusting the result.
Featured sponsor

Reach designers & developers at work

Put your product next to the tools people use every day. One sponsor per placement, no tracking pixels.

Become a sponsor

Keep reading

Related articles

More in VPN & Online Privacy
VPN & Online Privacy

10 Best Free Online Privacy Check Tools

Use ten reputable free privacy checkers to review browser tracking, account exposure, connection settings, and data breaches, with practical notes on what each result can and cannot tell you.

Includes: Subnet calculatorRavi DesaiRavi Desai
VPN & Online Privacy

Share a VPN Connection to Xbox or PlayStation via Ethernet

Share a supported Windows VPN connection with a console over Ethernet, avoid bridge mistakes, verify routing, and test what happens when the tunnel drops.

Includes: Subnet calculatorRavi DesaiRavi Desai
VPN & Online Privacy

Tailscale and WireGuard for Secure Home Lab Access

Combine Tailscale access with a separate WireGuard tunnel, plan nonoverlapping subnets, restrict home-lab routes, and verify secure remote connections.

Includes: Subnet calculatorRavi DesaiRavi Desai
VPN & Online Privacy

Dedicated IP VPN for Secure SSH Access to Cloud Servers

Restrict cloud SSH access to a dedicated VPN address, validate firewall rules safely, and keep a tested recovery path before closing public access.

Includes: Subnet calculatorRavi DesaiRavi Desai
VPN & Online Privacy

VPN Split Tunneling for Local Printers and NAS Access

Restore printer and NAS access while your VPN stays connected by checking subnets, adding precise local routes, and testing DNS and kill-switch rules.

Includes: Subnet calculatorRavi DesaiRavi Desai
VPN & Online Privacy

OpenVPN Client on Raspberry Pi: Install and Configure

Install an OpenVPN client on Raspberry Pi, protect its credentials, verify tunnel routes, and keep local server access working through reconnects.

Includes: Subnet calculatorRavi DesaiRavi Desai