Development discussion of WireGuard
 help / color / mirror / Atom feed
* wg-quick's Ethernet unplug problem
@ 2021-11-06 12:40 Tim Schumacher
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Schumacher @ 2021-11-06 12:40 UTC (permalink / raw)
  To: wireguard

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* wg-quick's Ethernet unplug problem
@ 2021-11-17 20:49 Tim Schumacher
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Schumacher @ 2021-11-17 20:49 UTC (permalink / raw)
  To: wireguard

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 12:40 wg-quick's Ethernet unplug problem Tim Schumacher
2021-11-17 20:49 Tim Schumacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).