Wireguard and VRFs?
Hi folks,
I just stumbled across wireguard and really like it!
While reading the docs and seeing the notes on network name spaces I started wondering if there's any support for Linux VRFs? [0]
What I'd like to do is builing a VPN tunnel using VRF "external" and terminate the tunnel within the main VRF. For OpenVPN this required a patch [65] for the setsockopt() but then works fine. Is something like this already possible with Wireguard?
And if not would you be open to adding it or merging a patch for it? I didn't look through the code yet, but I would suggest an option for the tun interface which will then trigger a setsockopt() call. Like a parameter for iproute for type wireguard interfaces.
Thanks a lot!
Best
Max
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/vrf.txt
[65] https://github.com/OpenVPN/openvpn/pull/65
Signature · 3 lines
"I have to admit I've always suspected that MTBWTF would be a more useful metric of real-world performance." -- Valdis Kletnieks on NANOG
Hi Max,
Yes, WireGuard supports this type of functionality through two more powerful mechanisms:
- fwmark, so you can do proper policy-based routing via ip rule with multiple tables
- network namespace, so that you can have the udp socket in one namespace and the actual interface in another
I imagine what you want is the fwmark feature, which seems to match up with much of the language used in vrf.txt. Check out the wg(8) manpage for details.
Regards,
Jason