Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PROPOSAL] wg-quick ip rule priority
@ 2020-04-05 17:37 vrein
  2020-04-10  7:39 ` Luis Ressel
  0 siblings, 1 reply; 2+ messages in thread
From: vrein @ 2020-04-05 17:37 UTC (permalink / raw)
  To: Wireguard

Hi everyone!
I have some tiny proposal for wg-quick utility: adding priority for iproute2 routing rules

For linux.bash this should be as easy as this:
https://gitea.tort.icu/vrein/wireguard-tools/commit/0947dc76770a5d81ba39340ebe9189b80a92584c

My personal use case:
  I have two peers: A, B

A: allowed ips: 0.0.0.0/0, ::/0
B: allowed ips: 10.5.0.0/24

And I need have connection to every peer.
If those peers are added to the single interface - wg0,
  then all traffic would be intercepted with A peer "allowed ips" mask.


Quick fix for this, which I implemented on my pc
  is to add `ip rule` with priority lower than 32766 but higher than 0
  and higher than other wg interface for peer B.

So there is two interfaces:
  wg0 - which intercepts all traffic
  wg1 - routes all traffic for 10.5.0.0/24 subnet

Here what I have on my PC:
0:      from all lookup local
125:    from all fwmark 0xca58 lookup main
125:    from all to 10.5.0.0/24 lookup 51800
10000:  not from all fwmark 0xca6c lookup 51820
10000:  from all lookup main suppress_prefixlength 0
32766:  from all lookup main
32767:  from all lookup default

Routing rules for wg1 could be added with `(Post|Pre)Up' directive.


PS:
Somehow, connectivity with both A and B peers were worked in single wg0 interface some time ago,
  but after few updates this feature stopped working.

Thank you for attention!



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

end of thread, other threads:[~2020-04-10  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 17:37 [PROPOSAL] wg-quick ip rule priority vrein
2020-04-10  7:39 ` Luis Ressel

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).