Guide
What Is a VPN Kill Switch and How Does It Work?
A VPN kill switch blocks your internet whenever the VPN isn’t protecting it, so nothing leaves your device with your real IP address.
Most big VPN apps have one. They don’t all switch it on for you, though, and they don’t all mean the same thing by the name. Some react when the connection drops. Others let nothing out except through the tunnel, and that second kind also holds up against attacks that never drop the connection at all.
- What it does: blocks traffic outside the VPN tunnel when the VPN drops, reconnects or switches servers.
- Is it on? On by default in ExpressVPN and PIA, always on in Mullvad, off in NordVPN until you turn it on.
- Standard or strict: standard modes do nothing when you disconnect yourself. Strict modes (Advanced, Strict, Lockdown, Always On) block everything until the VPN is back.
- Phones: Android has its own switch, Block connections without VPN. On an iPhone it depends on the app.
- No kill switch in your client? WireGuard for Windows and Tunnelblick on the Mac have one built in. On Linux and macOS, a few firewall rules do the job.
- Testing: end the VPN process or cut the Wi-Fi. Clicking Disconnect proves nothing.
How a kill switch works, and where it can fail
A VPN sends your traffic through an encrypted tunnel to its server. When the tunnel breaks, your device does what it would do without a VPN and sends traffic straight out over your normal connection. Downloads, cloud sync and open browser tabs carry on, now with your real IP address and visible to your network and your internet provider.
It rarely happens in a dramatic way. A laptop wakes from sleep, the phone hops from Wi-Fi to mobile data, you switch servers, the VPN app crashes. For a few seconds the tunnel isn’t there, and that’s enough for a torrent client to announce your real address to everyone in the swarm.
A kill switch closes that gap. There are two ways to build one, and the difference matters more than the name in the settings.
Disconnect detection or firewall rules
The simpler kind watches the VPN connection. When it notices a drop, it blocks traffic or cuts the network until the tunnel is back. Because it reacts, it only works if it notices the problem.
The stronger kind uses firewall rules on your device. While it’s on, traffic may leave only through the tunnel or towards the VPN server itself, and everything else is blocked all the time. Nothing has to be detected. Mullvad describes its desktop kill switch as firewall rules, Proton VPN its Windows one, and WireGuard’s own Windows app works the same way.
The TunnelVision attack showed why the design matters. In May 2024 researchers at Leviathan Security published a way (CVE-2024-3661) for someone on the same Wi-Fi network to use DHCP, the protocol that hands out local addresses, to push routes that send your traffic around the tunnel. The VPN stays connected, so in Leviathan’s words “features such as kill switches are never tripped.”
Providers with firewall-based kill switches answered that theirs block the leaked traffic anyway. ExpressVPN said its desktop apps are not affected while the kill switch is on. Mullvad, Proton VPN and PIA said their kill switches stop it too, although Mullvad and PIA list the iPhone as an exception. Android isn’t affected at all, because it doesn’t support the DHCP option the attack relies on. iPhones can be, and ExpressVPN and PIA advise using mobile data rather than untrusted Wi-Fi there.
Standard and strict modes
Most apps offer two levels. The standard mode blocks traffic when the VPN drops unexpectedly and stays out of the way when you click Disconnect yourself. ExpressVPN, Proton VPN and Surfshark (in its Soft mode) describe theirs exactly like that.
The strict modes block everything outside the VPN, whether the VPN is connected or not. ExpressVPN calls this “Enable at all times”, Surfshark calls it Strict, Proton VPN and PIA say Advanced, Mullvad says Lockdown mode and Windscribe says Always On. PIA’s Advanced Kill Switch also blocks the internet before the app has started, Proton’s advanced mode stays active after a restart, and Windscribe’s Always On works “with or without the Windscribe application running”.
You pay for strict mode in convenience: no VPN, no internet. That’s the whole point, and it gets annoying on the day you need to sign in to hotel Wi-Fi (the last chapter has the fixes).
System kill switch or app kill switch
A system kill switch blocks all traffic. An app kill switch, like NordVPN’s App Kill Switch, closes only the apps you pick when the VPN drops, say your torrent client, and leaves the rest of your internet alone. It protects exactly the apps on your list and nothing else.
Gaps a kill switch leaves
- Before the VPN app starts. Mullvad warns that on macOS its app “can’t ensure it starts before other applications start sending traffic”, and that some system services can leak before its service is running. PIA’s and Proton’s advanced modes exist for this gap.
- Apps you exclude with split tunneling. They still reach the internet in Mullvad’s Lockdown mode, by design. Proton VPN makes you turn split tunneling off to use its kill switch on every platform except Windows.
- The operating system’s own traffic. Android sends its connectivity checks outside the tunnel even with Block connections without VPN on. Proton VPN says some DNS requests from Apple services can bypass the VPN on Macs and iPhones, kill switch or not.
- Server switches on a Mac. Proton VPN mentions a brief moment when your real IP address may be exposed while its macOS app changes servers.
- A client that isn’t running. Tunnelblick’s kill switch only works while Tunnelblick and OpenVPN are running.
Do you need one?
Yes, if your VPN is there to hide your IP address: torrenting, public Wi-Fi, or a country where what you read or say online can get you in trouble. Keep it on there, and pick the strict mode if your app has one.
If you use the VPN only to watch another country’s streaming catalogue, a drop costs you a “not available in your region” message, not your privacy. The standard mode is plenty.
How to turn on the kill switch in popular VPN apps
Each app below can block traffic outside the VPN. What differs is the name, whether it’s on when you install the app, and how strict it can get.
Where to find the setting:
- ExpressVPN: Profile tab, then Settings, then Internet Kill Switch on Windows, Mac and Linux. Disconnect first; the setting can’t be changed while you’re connected. Local devices such as printers stay reachable through the “Allow access to devices on local network” setting.
- NordVPN: on Windows, the profile icon at the top right, then Settings, then Kill Switch. Choose Internet Kill Switch for everything or App Kill Switch for chosen apps.
- Surfshark: Settings, then VPN settings, then the Kill Switch toggle.
- Proton VPN: on Windows, Settings, then Kill switch (Advanced is optional). On a Mac, the kill switch icon in the Countries tab. On iPhone and iPad, Settings, then Security Options, then Kill switch.
- PIA: Settings, then Privacy, then VPN Kill Switch. Choose “Always” for the advanced mode.
- Mullvad: the kill switch needs nothing. For Lockdown mode, Settings, then VPN settings.
- Windscribe: Preferences, then Connection, then Firewall Mode.
If you want it on from the first connection
If you’d rather not go hunting through settings, ExpressVPN is an easy choice. Its Internet Kill Switch is on by default in the apps for Windows, Mac, Linux, Android and iPhone. In its router app you can’t turn it off at all. The desktop apps add the stricter “Enable at all times” mode, and ExpressVPN says those apps weren’t exposed to TunnelVision with the kill switch on. Our ExpressVPN review covers the rest of the service.
If you’d rather have a kill switch nobody can switch off by accident, Mullvad’s is built that way.
Kill switches on Android and iPhone
Android
Android has a kill switch of its own, and several VPN apps hand the job to it instead of building one. Proton VPN, Mullvad and PIA all do.
To turn it on, open Settings, then Network & internet, then Advanced, then VPN. Tap the gear next to your VPN app and switch on both Always-on VPN and Block connections without VPN. On newer Android versions, Google’s help gives the shorter path Network & internet, then VPN. Phone makers move the menu around; NordVPN also gives the path Settings, then Connections, then More connection settings, then VPN.
The two settings do different jobs. Always-on VPN, available since Android 7.0, starts the VPN and reconnects it. Block connections without VPN, available since Android 8, is the kill switch: no app gets online unless the VPN is up. Proton VPN says this combination “works more like advanced kill switch than standard kill switch”.
Its limits:
- Android exempts some of its own traffic. In Mullvad’s words, “some traffic such as connectivity checks are exempt by Android and will therefore leak outside the tunnel”. Mullvad reported this in 2022 and still documents it.
- It also blocks apps you excluded with split tunneling, and devices on your local network.
- Android TV doesn’t have the setting.
iPhone and iPad
iOS has no kill switch setting of its own for regular users. Apple’s always-on VPN is reserved for devices that a company manages. So it comes down to the VPN app.
Since iOS 14, an app can set a flag called includeAllNetworks. With it, according to Apple, “the system routes network traffic through the tunnel except traffic for designated system services”: DHCP, captive portal sign-ins on hotspots, some mobile-network services such as VoLTE calls, and traffic to a paired Apple Watch. It’s off unless the app turns it on, which is why the kill switch toggle sits in the app’s settings (in Proton VPN, under Security Options).
Even then, an iPhone kill switch is less airtight than a desktop one:
- Proton VPN says “some DNS requests from Apple services can bypass the VPN” on iPhone and iPad, and local network devices are out of reach while its kill switch is on.
- Tests by the security writer Michael Horowitz in 2022, updated in 2023, found Apple’s own services sending traffic outside the tunnel. Apple told him “the behavior you are seeing is expected.”
- TunnelVision can affect iPhones. On Wi-Fi you don’t trust, mobile data is the safer choice.
Macs use the same flag (since macOS 10.15), with the server-switching caveat from the first chapter.
How to set up a kill switch yourself (OpenVPN and WireGuard)
If you connect with configuration files from your provider, or to your own server, no provider app watches the tunnel for you. Some clients have a kill switch built in; for the rest, a few firewall rules do the job.
Three things first:
- Use the VPN server’s IP address in your configuration, not its host name. Once everything outside the tunnel is blocked, your device can’t look the name up anymore.
- Note the server’s port and protocol: the
remoteline of an OpenVPN file, or theEndpointline of a WireGuard file. OpenVPN usually runs on UDP 1194, WireGuard on UDP 51820, but providers use others. - Read the undo step before you start. A kill switch that locks you out is still a kill switch, just not a fun one.
The examples use 203.0.113.10 as the server address. Replace it with yours.
Windows: WireGuard app
The official WireGuard app for Windows has a kill switch. Select your tunnel, click Edit, and tick Block untunneled traffic (kill-switch).
According to WireGuard’s documentation, it applies when the tunnel has a single peer whose AllowedIPs contain a /0 route (0.0.0.0/0, ::/0 or both). WireGuard then allows only its own packets, DNS to the servers in your configuration, loopback, traffic through the tunnel, DHCP and IPv6 neighbour discovery. “All other packets are blocked.”
That includes your printer and your NAS. Unticking the box makes the local network reachable again, but Mullvad warns that “it is not recommended to keep it off permanently as it can open up for possible IP or DNS leaks.”
Windows, Mac, Android, iOS: OpenVPN Connect
OpenVPN’s official app has a setting called Seamless Tunnel: open the menu, then Settings. OpenVPN describes it in one line, “Block the internet while the VPN is paused or reconnecting.” Under Advanced Settings, Block IPv6 stops IPv6 traffic, worth turning on if your VPN server doesn’t carry IPv6.
Seamless Tunnel covers the most common leak, the reconnect. OpenVPN doesn’t say it protects you when the app crashes or is closed. To reconnect after a reboot, set Launch Options to “Restore connection”.
Windows: OpenVPN GUI
The community client, OpenVPN GUI, has no kill switch. Windows Defender Firewall can be made into one, but its default-block setting only stops traffic that “does not match an outbound rule”, in Microsoft’s wording, and Windows ships with outbound allow rules for its own components. A hand-built setup there needs care. The simpler routes are OpenVPN Connect with Seamless Tunnel, the WireGuard app if your provider offers WireGuard files, or the provider’s own app.
Whatever you use, the OpenVPN options further down reduce leaks during reconnects and DNS leaks on Windows.
Mac: Tunnelblick
Tunnelblick, the free OpenVPN client for macOS, has a kill switch for each configuration. Open the VPN Details window, go to the Configurations panel, then the Settings tab, and set On unexpected disconnect to Disable network access.
When it triggers, Tunnelblick turns off all network access, local network included, and networks over Thunderbolt, FireWire and Bluetooth (Bluetooth keyboards and mice keep working). Access stays off until you choose Re-enable Network Access at the top of the Tunnelblick menu, even after a restart. If Tunnelblick won’t run, open System Settings, then Network, select each service marked “Inactive” and choose “Make Service Active”.
Tunnelblick is upfront about the limits. It is “not a ‘firewall'”, it does nothing if Tunnelblick or OpenVPN isn’t running, and it shouldn’t be used with more than one VPN connected.
Mac: pf firewall (OpenVPN or WireGuard)
macOS has a packet filter built in, pf. A kill switch with it blocks everything, then allows the loopback interface, the VPN tunnel and the connection to the VPN server.
Connect to the VPN and run ifconfig in Terminal to see which utun interface it uses (utun0, utun3, utun4…). The number varies, and with the wrong one nothing gets through. Then open the file with sudo nano /etc/pf.conf and add these lines at the end:
block drop all
pass on lo0
pass on utun4
pass out proto udp from any to 203.0.113.10 port 1194
pass out proto udp from any port 68 to any port 67
Replace utun4, the address and the port (for WireGuard, the port from the Endpoint line). In pf the last matching rule wins, so the pass lines override the block for those connections. The last line lets your Mac renew its local address from the router.
Load and switch on the rules:
sudo pfctl -f /etc/pf.conf
sudo pfctl -e
To undo, sudo pfctl -d turns pf off. Remove the lines from pf.conf as well, or they come back the next time the file is loaded. After a restart, check that pf is running with sudo pfctl -s info. If the VPN later picks another utun number, the tunnel is blocked too, which fails safe but looks like a broken VPN.
Linux: WireGuard with wg-quick
The wg-quick manual includes a kill switch. Add two lines to the [Interface] section of your configuration (for example /etc/wireguard/wg0.conf):
PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
They reject every outgoing packet that doesn’t go through the tunnel, isn’t WireGuard’s own encrypted traffic and isn’t for the machine itself. This works with AllowedIPs set to 0.0.0.0/0. For IPv6, Mullvad’s guide adds the same rule with ip6tables, joined to each line with &&.
The manual notes that “most DHCP traffic still passes”. Your local network doesn’t. Mullvad suggests an exception such as ! -d 192.168.1.0/24 in both lines if you need it.
The rule lives as long as the interface. wg-quick down wg0 removes it, so this is a standard kill switch, not a strict one.
Linux: OpenVPN with ufw
ufw is the firewall front end on Ubuntu and many other distributions. This ruleset, adapted from the guides of Akamai (Linode) and IVPN, allows only the tunnel, your local network and the VPN server:
sudo ufw --force reset
sudo ufw default deny incoming
sudo ufw default deny outgoing
sudo ufw allow out on tun0
sudo ufw allow in on tun0
sudo ufw allow out on wlp6s0 to 192.168.0.0/24
sudo ufw allow in on wlp6s0 from 192.168.0.0/24
sudo ufw allow out on wlp6s0 to 203.0.113.10 port 1194 proto udp
sudo ufw enable
Replace tun0 with your tunnel interface (wg0 if you use WireGuard), wlp6s0 with your network interface (ip a shows both), and the subnet, address and port with yours. The first line deletes your existing ufw rules, so note them first.
ufw stays enabled after a reboot, which makes this a strict kill switch: no VPN, no internet. sudo ufw disable turns it off and keeps the rules for later; sudo ufw --force reset deletes them.
OpenVPN options that help, and what they don’t do
These lines go into your .ovpn file. They reduce leaks, but none of them blocks anything once OpenVPN stops running, so they work alongside a kill switch rather than replacing one.
persist-tunkeeps the tunnel device and its routes in place while OpenVPN restarts a connection, so traffic doesn’t fall back to your normal connection during a reconnect.block-outside-dns(Windows only) blocks DNS servers on your other network adapters to prevent DNS leaks. Other systems treat it as an unknown option and refuse to start, unless you write it assetenv opt block-outside-dns.redirect-gateway def1sends all traffic into the tunnel with two narrower routes, without deleting your default route. Adding theblock-localflag also blocks your local network while the tunnel is up, except the router itself. It’s routing, not a firewall.
Routers
A kill switch on the router protects every device behind it, including TVs and consoles that can’t run a VPN app. ExpressVPN’s router app has its kill switch permanently on.
On pfSense, which sends LAN traffic out through a VPN gateway with a policy rule, check one default. If that gateway goes down, Netgate’s documentation says “the rule will act as if the gateway was not set at all”, so traffic leaves through your normal connection. Turn on Do not create rules when gateway is down under System, then Advanced, then Miscellaneous, and put a block rule right below the VPN rule.
How to test your kill switch
Clicking Disconnect proves nothing, because standard kill switches ignore a disconnect you asked for. Make the VPN fail the way it fails on its own:
- Connect, then watch your IP address. On a Mac or Linux, a loop from ipconfig.io’s guide does it in Terminal:
while true; do curl -s --max-time 2 ipconfig.io || echo "BLOCKED"; sleep 1; doneOn Windows, keep an IP-check website open and reload it. Check that you see the VPN server’s address.
- Break the tunnel the hard way. End the VPN process in Task Manager on Windows, or force quit it in Activity Monitor on a Mac. Or turn the Wi-Fi off and on, or block the VPN server’s address in your router.
- A working kill switch gives you errors (or BLOCKED) until the VPN is back. If your real IP address shows up even once, it failed.
- If the VPN address is back within a second, the app reconnected faster than the check. Block the server’s address instead and look again.
- For strict modes, restart the computer and check before the VPN connects.
The VPN provider OVPN and the IP-check service ipconfig.io describe the same approach.
Kill switch blocking your internet? How to get back online
A kill switch that leaves you offline is usually doing its job. Here’s what’s behind it most of the time:
- The VPN dropped and hasn’t reconnected. Reconnect, or pick another server. With Surfshark, for example, the internet stays cut until you reconnect to one of its servers.
- You disconnected and still have no internet. A strict mode is on: ExpressVPN’s “Enable at all times”, Surfshark Strict, Proton’s or PIA’s advanced mode, Mullvad’s Lockdown mode or Windscribe’s Always On. Connect, or switch back to the standard mode in the app. Windscribe’s Always On blocks even when the app isn’t running, so open the app to change it.
- The hotel or airport Wi-Fi login page won’t load. NordVPN advises turning the kill switch off briefly to sign in, then back on.
- The printer, NAS or TV has disappeared. Many kill switches block your local network: Proton VPN on Mac and iPhone, the WireGuard app on Windows, Android’s Block connections without VPN, Tunnelblick. In ExpressVPN, check “Allow access to devices on local network”.
- Tunnelblick cut the network. Choose “Re-enable Network Access” at the top of its menu.
- A setup from this guide.
sudo pfctl -don a Mac,sudo ufw disableorwg-quick down wg0on Linux.
Frequently Asked Questions
Some people found answers to these questions helpful
Is a VPN kill switch on by default?
It depends on the app. ExpressVPN and PIA switch theirs on by default, Proton VPN does on Windows and in its Linux app, and Mullvad's can't be turned off. NordVPN's is off on Windows, Mac, Android and Linux until you turn it on. Surfshark and Windscribe don't say on their help pages, so check the setting.
Does a kill switch work if I disconnect the VPN myself?
Not in standard mode. ExpressVPN, Proton VPN and Surfshark's Soft mode block traffic only when the connection drops unexpectedly. To stay offline without the VPN, use a strict mode: ExpressVPN's "Enable at all times", Surfshark Strict, Proton's or PIA's advanced kill switch, Mullvad's Lockdown mode or Windscribe's Always On.
What's the difference between Always-on VPN and a kill switch?
On Android, Always-on VPN starts the VPN and reconnects it, but on its own it doesn't block anything. Block connections without VPN is the kill switch. Turn on both.
What is an app kill switch?
An app kill switch closes only the apps you choose when the VPN drops, for example a torrent client, and leaves the rest of your connection working. NordVPN calls it App Kill Switch. A system kill switch blocks all traffic instead.
Can I use split tunneling with a kill switch?
Sometimes. Proton VPN supports both together only on Windows. In Mullvad's Lockdown mode, excluded apps keep their internet access, by design. On Android, Block connections without VPN blocks the excluded apps as well.
Does a kill switch stop DNS leaks?
A firewall-based one does most of the work. WireGuard's Windows kill switch, for example, lets DNS through only to the servers in your configuration. It doesn't cover everything: Proton VPN says some DNS requests from Apple services can bypass the VPN on Macs and iPhones even with its kill switch on. For OpenVPN on Windows, add block-outside-dns to the configuration.
3 Comments
Michael Rossall
December 28, 2023 5:03 pm
Thanks for the excellent explanations. I’m a beginner in this field, but you have given me the confidence to pursue it.
Raul
June 4, 2023 7:15 pm
Hi, thanks for the post. I tried to use the command prompt “route delete 0.0.0.0” after open vpn was established. After my vpn was on and I could navigate the internet, I issued the command route delete. Once I did that and got the OK, I could not any longer browse the internet although Open VPN was on. Lost internet connection.
BettyFan
June 30, 2020 9:01 am
If you’re searching for a VPN, I feel like having a kill switch is a must. If you care about your security, you obviously would want to be sure that your VPN works. For example, the VPN I recently got (Surfshark) has a kill switch that cuts off your internet connection.