EisfunkeForum

Routing Specific Docker Containers Through WireGuard VPN with systemd-networkd

Nah - nothing on this build really.

Clean build of Ubuntu Mate targeting RaspberryPi-s (x64)
I did try turning on ipv4 forwarding at one point but that would only help - can’t hurt. (And that was after all the failures).

EDIT: I guess in the spec for .network it does specify that gateway and address should each only include one ipv4 or ipv6 but you can specify multiple and it does call out CIDR so there has to be someway to work this all out. I am not a networking guru so not sure if that has any impact. It does say you can specify multiple. https://www.freedesktop.org/software/systemd/man/systemd.network.html#Address=

Edit 3
One interesting thing to note Mullvad’s files specify a cidr but they are a single address CIDR. I retried again with CIDR for Address (/32) and single for gatway and it continued to work. I don’t think its a concern since the VPN is only giving me one address to use whether its static or CIDR.

I tried your solution with both the Gateway AND Address to a single instance and it did work…
I have no idea why that worked ha.

Also - feel free to tell me how you made those collapsible sections so my posts can be cleaned up.

feeder@ubuntu-mate:~$ cat /etc/systemd/network/85-wg0.network
[Match]
Name=wg0

[Network]
Address = 10.23.23.23

[RoutingPolicyRule]
From = 10.123.0.0/16
Table = 242

[Route]
Gateway = 10.23.23.23
Table = 242

[Route]
Destination = 0.0.0.0/0
Type = blackhole
Metric = 1
Table = 242

Glad to hear that you figures it out :slight_smile:

I’m probably not the person to tell you to avoid IPv6 as it’s not my expertise, however, I follow the ideology to avoid IPv6 at all costs. There are of course several reasons for that, from privacy to increased performance. For instance, I’m using Debian and Ubuntu, so disabling IPv6 for apt (package management) makes it faster.

At the bar to the right above where you type there is a cog you can press where you’ll find “Hide Details” :+1: