Site icon New Generation Enterprise Linux

Stop WireGuard from leaking packets when the interface goes down

Networking & Firewalls (Nftables/Iptables/WireGuard)

Stop WireGuard from leaking packets when the interface goes down

Technical Briefing | 11/25/2026

You set up a WireGuard tunnel, point your traffic through it, and call it a day. Everything looks solid until your ISP drops the connection or you trigger an interface restart. For those few seconds the interface is down, your OS decides it’s perfectly fine to route that sensitive traffic out through your default gateway in the clear. I’ve seen this leak credentials to public networks more times than I care to admit.

Why the routing table isn’t enough

The standard approach relies on routing metrics, but that is reactive. If the WireGuard interface vanishes, the kernel automatically falls back to the next best route—usually your main ethernet or Wi-Fi. You need a way to tell the firewall that if a packet belongs to the tunnel, it stays in the tunnel or it dies. Don’t rely on the interface existing to keep your packets secure.

nft add rule inet filter output oifname != wg0 ip daddr 10.0.0.0/24 drop
  • Binding your traffic to the specific output interface creates a hard fail-safe
  • Using nftables sets gives you a cleaner way to handle dynamic tunnel subnets
  • Test this by manually bringing the interface down and watching your traceroute hit a black hole

The rule I showed forces the kernel to drop any traffic headed for your internal network if the outgoing interface isn’t your tunnel. It feels aggressive, but that is the point. If your traffic isn’t encrypted, it shouldn’t be leaving your machine at all. Stick this in your nftables config, reload it, and you’ll never have to worry about interface flappiness leaking your data again.

Linux Admin Automation  |  © www.ngelinux.com  |  11/25/2026
0 0 votes
Article Rating
Exit mobile version