You are not logged in.

#1 2021-03-16 10:30:29

TheCoon
Member
Registered: 2016-05-10
Posts: 42

Automatic network routes creation for WireGuard using systemd-networkd

I am using systemd-networkd for network management, dnscrypt-proxy for DNS (DoH), and WireGuard for connecting to an AWS VPC.
I am trying to connect to a MongoDB server hosted by Atlas on AWS within the same WireGuarded internal network.
I do not route all of my traffic through the WireGuard interface. I have a .network file in which I define [Route] sections for different subnets which I need access to. Most of these Route sections look similar to the following:

[Route]
Gateway = 10.10.0.1
Destination = 10.10.0.0/24
GatewayOnlink = true

Up until now, I have defined a new Route for new servers which I need access to, and restarted systemd-networkd so that everything takes effect.
I have a feeling that I am putting in too much effort for this setup to work. Is there a more streamlined way of detecting and adding new Routes for the WG interface to handle?

The issue I am having now is that I simply cannot connect to the MongoDB server I mentioned earlier. I've tried monitoring the different addresses being accessed during the connection initiation using WireShark, and adding what seems relevant to new Route sections, but I still can't successfully connect.
How can I go about debugging this, pinpointing exactly what stifles the connection, and going forward, how to better manage routes handled by the WG interface (both in terms of detecting the relevant addresses and adding them to the .network file).

Thanks for any help.

Offline

#2 2021-03-16 12:59:10

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: Automatic network routes creation for WireGuard using systemd-networkd

10.0.0.0/8

?

Offline

#3 2021-03-16 13:06:24

TheCoon
Member
Registered: 2016-05-10
Posts: 42

Re: Automatic network routes creation for WireGuard using systemd-networkd

Zod wrote:

10.0.0.0/8

?

The thing is, 10.50.0.0/16 is used for a subnet that shouldn't be routed through WG. In addition to that, 10.x.x.x aren't the only addresses that need to be routed through WG - some 192.x.x.x addresses, some non-reserved subnets, etc.

Offline

#4 2021-03-17 11:04:20

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: Automatic network routes creation for WireGuard using systemd-networkd

As far as I understand, systemd simply doesn't have this functionality yet. It's possible to do, but as you said, with some efforts that seldom worth it.
https://github.com/systemd/systemd/issu … -724582995

Offline

#5 2021-03-17 11:24:35

TheCoon
Member
Registered: 2016-05-10
Posts: 42

Re: Automatic network routes creation for WireGuard using systemd-networkd

finoderi wrote:

As far as I understand, systemd simply doesn't have this functionality yet. It's possible to do, but as you said, with some efforts that seldom worth it.
https://github.com/systemd/systemd/issu … -724582995

Are there any helper tools I can use to automate this, or would I have to switch to another network manager altogether?

Offline

#6 2021-03-17 11:29:30

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: Automatic network routes creation for WireGuard using systemd-networkd

I use wireguard-tools. wg-quick adds routes automatically based on 'AllowedIPs=' and works fine with systemd-networkd.

Offline

Board footer

Powered by FluxBB