WireGuard as a “Switch”



Not really a switch, but similar. If you want to exchange data from two network using a host on Internet, this post helps.

In this case, Router 1 want to use Router 2 as gateway for some destinations. All 3 Nodes here have Internet public IP address.

I set-up a network, 192.168.20.0/24, using WireGuard. Our work are all on the Server in the middle.

If I put such config to /etc/wireguard/wg0.conf and run wg-quick up wg0, then I may lost connection to the server, because of the default route.

Now, add a route table to your system and change wg0.conf, let’s name it wgswitch and table id 201.

Then modify wg0.conf.

Now when you establish connections, you’ll be able to ping from router1 to router2 using 192.168.20.0/24 network.

But if you want to try a custom network, that’s not enough, you need extra route and ip rule for your network



WireGuard as a “Switch” by @sskaje: https://sskaje.me/2019/11/wireguard-as-a-switch/

Incoming search terms: