Stop WireGuard from leaking traffic when the interface flaps
Technical Briefing | 11/30/2026
You set up a WireGuard tunnel, point your default route through the wg0 interface, and feel pretty good about your privacy. But then your network connection blips, the interface goes down for a second, and your kernel happily fails back to your main ISP gateway. That’s a classic routing leak that nobody notices until they audit their own egress traffic.
Routing tables are not firewalls
The kernel doesn’t know that your traffic was intended to be encrypted. It just sees the interface go down and looks for the next best path to the internet. If you have an existing default route via eth0, the kernel will just route packets there. Most tutorials don’t warn you about this, but you need to explicitly prevent the kernel from sending traffic out the WAN interface when the tunnel drops.
nft add chain inet filter output { type filter hook output priority 0 ; }
nft add rule inet filter output oifname eth0 ip daddr != 192.168.1.0/24 accept
nft add rule inet filter output oifname != wg0 ip daddr != 192.168.1.0/24 drop
- Use oifname to restrict traffic explicitly to your physical interface
- Define your local network range to avoid cutting off access to your router or NAS
- Test this by bringing the wg0 interface down and pinging an external IP
This approach is much cleaner than messing with complex policy-based routing tables that tend to break after a kernel update or a reboot. Once you’ve locked the output path to the tunnel interface, your traffic either flows through the crypto stack or it doesn’t move at all. You will never have to worry about silent leaks again.
