VyOS Policy Based Routing with WireGuard + Mullvad

Here is a quick guide to setting up policy based routes for VyOS or other Vyatta variants such as EdgeOS.

VyOS Policy Based Routing with WireGuard + Mullvad

I wrote a similar post on doing this with OpenVPN using PIA, however this setup is much simpler as we are able to make use of interface routes. Check out the older article in the link below if you want to learn more.

VyOS Policy Based Routing with OpenVPN
Make a selection of hosts use a vpn connection

VPN Provider

Although PIA says they support WireGuard, their implementation is non-standard and confusing. I found some projects that attemt to reverse engineer the protocol such as https://github.com/thrnz/docker-wireguard-pia, and PIA themselves later released their own scripts for manual connections.

In the end I ended up going for Mullvad, mostly due to their standardized WireGuard setup https://mullvad.net/en/help/why-wireguard/, and its been going great. Currently i am able to saturate my 300mbit link using a single tunnel.

VyOS configuration

This guide assumes that you are familiar with doing configuration changes in VyOS. While I have chosen mullvad, this could be done using any other provider as well. Im currently on the latest rolling release which is 1.4-rolling-202101300218. There may be some issues with earlier images not accepting interface routes, so I can't vouch for other versions. One issue I had with this image is that I can no longer configure smp_affinity which I am still resolving.