Skip to content

Why Does a Linux Laptop Keep a VPN Route After the App Crashes?

When a VPN app dies on Linux, the kernel does not always undo what it set up. See which leftovers can remain, how to find them and how to clear them without guesswork.

10 min readUpdated Nov 11, 2026By XPASS Editorial Team

Why Does a Linux Laptop Keep a VPN Route After the App Crashes?

You connect to a VPN on a Linux laptop, the app crashes or gets killed, and suddenly web pages will not load. You restart the app and it does not help. Yet nothing looks broken: Wi-Fi shows connected and the laptop has an IP address. What you are usually looking at is leftover state. While a VPN runs, it changes how your laptop sends traffic, and a crash can end the program before it has a chance to change things back.

This article explains what those changes are, why some of them stay behind, and how to find and clear them with ordinary tools. It is generic Linux diagnostic guidance, not a description of any one app's internal behaviour. If you want the background on how tunnels use the routing table, read Linux VPN routing tables explained first. Here we focus on the narrow question of what happens after the app dies.

What a VPN client changes on Linux

A VPN client is not just a window with a connect button. When it connects, it normally touches several parts of the system, and each part has its own rules about what happens when the program stops.

  • A network interface. A tunnel appears as a virtual device with a name such as tun0, wg0 or similar. The name depends on the client.
  • Routes. The client adds entries to the routing table so that traffic goes into the tunnel. Often these are two broad routes that together cover all of IPv4, plus one special route that keeps the packets to the VPN server on the normal network.
  • Policy rules. Some clients use ip rule entries and a separate routing table so that only certain traffic follows the tunnel.
  • DNS settings. The client may point your system at a different DNS server for the tunnel interface or rewrite the resolver configuration.
  • Firewall rules. If a kill switch or a leak-protection feature is on, it adds rules that block traffic outside the tunnel.

When you disconnect normally, the client reverses each of these. When it crashes, none of the reversal code runs. Whether you end up with a problem depends on which of those changes belong to a process, and which belong to the kernel.

Why some leftovers survive a crash

Linux keeps most of this state in the kernel, not inside the application. That has a useful consequence and an annoying one.

The useful one: if a virtual interface is owned by a process and the process dies, the kernel normally removes the interface. And when an interface disappears, the routes that pointed through it disappear with it. In many crashes this means the system heals itself within a second.

The annoying one: some state is not tied to the process at all.

  • A tunnel interface created as a persistent device stays after the process ends. Its routes stay with it.
  • A kernel-level tunnel interface can remain configured even when the program that set it up is gone, because the kernel, not the program, holds it.
  • Routes that point out of your normal Wi-Fi or Ethernet interface, such as the special route to the VPN server, remain because that interface is still alive.
  • Policy rules and the extra routing tables they use are separate objects, and nothing removes them automatically.
  • Firewall rules live in the kernel until something deletes them.
  • DNS settings applied through systemd-resolved or NetworkManager can stay assigned to a link.

So the honest answer to the question in the title is this: the laptop keeps the route because the route belongs to the kernel, and the kernel has no way to know that the program that added it has gone. It only removes what is clearly attached to something that no longer exists.

Recognising the symptoms

Leftovers produce a few typical patterns. Matching yours helps you look in the right place.

What you see Likely leftover
No web pages, but pinging a raw IP address works DNS still points at the tunnel's resolver, or a stale DNS setting
Nothing works, even raw IP addresses A default route or half-default routes pointing at a dead interface
Only some sites load A stale route, a policy rule or an IPv6 route sending part of the traffic away
Connection works only after a reboot Any of the above, held in kernel memory
Traffic is blocked right after the crash A kill switch firewall rule that is doing exactly what it was built to do

The last row is worth pausing on. If you configured a kill switch, a blocked connection after a crash may not be a bug at all. That is the rule protecting you from sending traffic outside the tunnel. You still need to remove it to get back online, which is covered below. For how such rules are built, see how to configure a Linux VPN kill switch.

Step 1: Look before you change anything

Open a terminal and read the current state. These commands only display information and are safe to run.

  1. ip link lists interfaces. Look for a tunnel device that is still present, usually with a name like tun0 or wg0, or a state of UNKNOWN or DOWN.
  2. ip route lists IPv4 routes. Look for a default line and for any lines that mention the tunnel device.
  3. ip -6 route does the same for IPv6. People often forget this one, and IPv6 leftovers cause the confusing "some sites work" symptom.
  4. ip rule lists policy rules. A normal system shows three short default rules. Extra lines usually mean a VPN added them.
  5. resolvectl status shows which DNS server each interface uses, on systems that use systemd-resolved. If a tunnel link still has a DNS server, that is a candidate.
  6. List your firewall rules with the tool you use, for example sudo nft list ruleset or sudo iptables -S. Look for rules mentioning the tunnel interface or dropping traffic from other interfaces.

Copy the output of ip route into a text file before you change it. If something goes wrong, you can see what the original default route looked like.

Step 2: A plain example

Suppose ip route prints this after a crash.

0.0.0.0/1 dev tun0 scope link
128.0.0.0/1 dev tun0 scope link
default via 192.168.1.1 dev wlp3s0 proto dhcp metric 600
203.0.113.10 via 192.168.1.1 dev wlp3s0
192.168.1.0/24 dev wlp3s0 proto kernel scope link src 192.168.1.42

The first two lines send nearly all IPv4 traffic to tun0. They are more specific than default, so they win. If the process that was reading from tun0 is gone, packets go into the interface and nowhere else, which is why nothing loads. The 203.0.113.10 line is the host route to the VPN server, kept on the normal network so the tunnel's own packets can get out. The default line is your original route and is untouched.

The fix is to remove the tunnel's routes or the tunnel itself. Once the two half-default routes are gone, the original default line takes over again. The addresses here are documentation examples; yours will differ.

Step 3: Clear leftovers safely

Work from the least invasive option to the most invasive. Stop as soon as the connection recovers.

  1. Reconnect and disconnect cleanly. Open the VPN app again, connect, then disconnect with the normal button. A well-behaved client reverses its own changes on a clean disconnect, which often clears what the crash left. If the app will not start, move on.
  2. Remove the stale interface. If ip link still shows the tunnel device, sudo ip link delete tun0 (using your device name) removes it, and the kernel removes routes that pointed through it. If the command says the device is not of a type that can be deleted this way, the client's own tool may be the right way to bring it down.
  3. Delete individual routes. If routes remain after the interface is gone, or the interface is not the problem, remove the specific lines, for example sudo ip route del 0.0.0.0/1. Match the line you saw exactly. Do not delete your original default route.
  4. Remove policy rules. sudo ip rule del with the same values shown by ip rule removes an extra rule. If a client created a custom routing table, flushing that table with ip route flush table NUMBER clears its contents.
  5. Reset DNS for the link. With systemd-resolved, sudo resolvectl revert LINK removes the settings that were applied to that link. If your system uses another resolver setup, check the file or service that manages it.
  6. Remove the firewall rule. Delete only the rules you recognise as the kill switch, or reload your normal firewall configuration. Do not flush everything on a machine where you rely on other rules, since that opens ports you may have meant to keep closed.
  7. Restart the network manager. sudo systemctl restart NetworkManager rebuilds the connection state on many desktop systems. You will briefly lose the network.
  8. Reboot as a last resort. Routes, rules and in-memory firewall rules do not survive a reboot. Saved firewall files and saved connection profiles can.

Be careful with copied commands. Interface names, table numbers and addresses differ from system to system, and a route deleted by mistake can lock you out of a remote session. If the laptop is a machine you reach over SSH, do this at the keyboard if you can.

IPv6 and DNS: the quiet leftovers

Two leftovers are easy to miss because they do not look like a VPN problem.

IPv6. Many networks give your laptop both IPv4 and IPv6 addresses. If a VPN client added IPv6 routes or blocked IPv6 and the crash left that in place, IPv4 may work while IPv6 destinations hang or the other way round. Browsers try both and wait on timeouts, which feels like random slowness. Check ip -6 route as carefully as the IPv4 table. The reasons IPv6 matters for privacy are covered in the Linux VPN DNS leak guide.

DNS. If the system is still asking a resolver that lives inside the tunnel, every lookup fails even though raw connections work. Test with a pure IP connection and a name lookup separately: if ping 1.1.1.1 style tests work but a name does not resolve, look at DNS before routes.

What this does not tell you

Be realistic about the limits of this advice.

  • It cannot tell you why a particular app crashed. A crash can come from a bug, a memory problem, a driver conflict or a system update. For the general path of diagnosing a dying VPN app, see VPN app crashes or freezes.
  • Different clients behave differently. Some clean up on their next start, some use a helper service that restores state, and some leave it to you. Treat the list above as what can happen, not what will.
  • Exposed traffic after a crash is a real possibility. If a kill switch is not set up, the moment the tunnel dies your traffic can leave through the normal connection. A VPN does not guarantee protection in that moment.
  • Commands change the live system. Everything above affects your network configuration. Write down what you change.

If you use VPNclient, the free app that connects with the details on your My Pass page, its Linux version is for 64-bit Intel or AMD desktops with systemd. Its exact cleanup behaviour is not something this article can describe. If leftovers keep appearing after normal disconnects, note the commands and output above and contact support.

Preventing a repeat

You cannot stop every crash, but you can make the next one cheaper.

  • Disconnect with the app's normal control before closing it, before sleeping the laptop for a long time and before shutting down for an update.
  • Keep the system and the VPN app updated, since crashes often come from a driver or library mismatch.
  • If you build your own kill switch, write it so that you can remove it with one command, and keep that command in a note.
  • Save a copy of your normal ip route output while healthy. Comparing it against a broken table makes leftovers obvious in seconds.
  • Learn the three commands that reset the most, ip link, ip route and ip rule, so you are not searching for them when the internet is down.

For the full install and first-run steps, see how to set up a VPN on Linux.

Summary

A Linux laptop keeps VPN routes after a crash because routes, policy rules, DNS settings and firewall rules belong to the kernel and the network services, not to the app, and only some of them vanish automatically when the app dies. Look first with ip link, ip route, ip -6 route, ip rule and your firewall listing, remove only the entries that clearly belong to the tunnel, and reboot if you have to. If you would like step-by-step setup help for your device, the XPASS help center is a good place to start.

Frequently asked questions

Why does my Linux internet stop working after a VPN app crashes?

The app changes routes, DNS settings or firewall rules while it runs and normally reverts them when it disconnects. A crash skips that cleanup, so some changes can remain and send traffic toward a tunnel that no longer carries it.

Will a reboot always fix leftover VPN routes?

Usually, because routes, policy rules and most firewall rules held in memory are rebuilt at boot. Settings that were saved to disk, such as a persistent firewall file or a saved connection profile, can survive a reboot.

Which commands show leftover VPN state?

ip link, ip route, ip -6 route, ip rule, resolvectl status and a listing of your firewall rules show most of it. Read them first and change nothing until you know which entries belong to the VPN.

Is it safe to delete a route by hand?

Deleting a single, clearly identified route is low risk and reverts on reboot, but removing the wrong one can cut your connection. Note the existing default route before you start so you can restore it.

Can the app prevent leftovers in the first place?

You cannot fully prevent a crash, but disconnecting cleanly before closing the app, keeping the system updated and checking what a kill switch rule does before you rely on it all reduce the chance of a mess.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Need a VPN for a short trip or a busy month?

XPASS sells prepaid passes for a set number of days. You pay once and nothing renews automatically.

See passes

Keep reading

Device Guides

Linux VPN Routing Tables Explained

A VPN on Linux is mostly a set of routing decisions. Learn to read ip route, understand the half-default trick and policy tables, and diagnose why traffic goes the wrong way.

9 min read

Device Guides

How to Configure a Linux VPN Kill Switch

On Linux a kill switch is a firewall rule, not a button. Three ways to build one, what traffic must still be allowed, and a safe test routine.

10 min read

Troubleshooting

VPN App Keeps Crashing: Common Fixes

A practical guide for a VPN app that closes itself, freezes or loops back to the start: how to describe the failure, the common causes and fixes for phone and computer.

9 min read