wg-quick's Ethernet unplug problem

Tim Schumacher tim at tschumacher.net
Wed Nov 17 20:49:52 UTC 2021


Hi,

there is this annoying problem with the way wg-quick sets up the 
routing, that when you unplug the Ethernet cable the routing rule (see 
ip rule) that checks the fwmark gets lost. So let's say you move to 
another location with your laptop and plug in an Ethernet cable again, 
it essentially disables your VPN. You're lucky if you have the popular 
kill switch in place blocking all your traffic instead of silently 
disabling your VPN.

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

I have no idea why the rule gets lost. It might be the kernel removing 
it for whatever reason. But it makes no sense to me because I don't see 
how the kernel would make a connection between that rule and the 
Ethernet link that goes down. Any ideas on the issue? Is this a known 
problem? Are there workarounds?

Greetings,
Tim



More information about the WireGuard mailing list