[PROPOSAL] wg-quick ip rule priority

vrein at tuta.io vrein at tuta.io
Sun Apr 5 19:37:18 CEST 2020


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!




More information about the WireGuard mailing list