You are not logged in.
Hi,
I am trying to setup wireguard using systemd. wireguard-tools performed series of commands like:
ip -4 route add 10.0.0.0/8 dev wg0-dev
.
I would like to recreate it using systemd, for now I have this unit file:
[Match]
Name = wg0
[Network]
Address = x.x.x.x
DNS = x.x.x.x, x.x.x.x
DefaultRouteOnDevice=true
[Route]
Destination = 10.0.0.0/8
GatewayOnlink=true
Scope = link
However it doesn't produce desired results as ip -r doesn't show this route. How can I specify route with device instead of gateway?
Offline
[Match]
Name=wg0
[Network]
Address=10.0.0.123/8
DNS=x.x.x.x, x.x.x.x
DefaultRouteOnDevice=true
Should already do the trick. See https://www.freedesktop.org/software/sy … twork.html
Last edited by Swiggles (2019-10-10 19:12:56)
Offline
Thanks for response.
Unfortunately it adds default route through wg0, ip r gives:
default dev wg0 proto static
I would like to have only some routes on wg0, something like:
10.0.0.0/8 dev wg0 scope link
Last edited by connexion2000 (2019-10-10 12:12:29)
Offline
/etc/systemd/network/wg0.network
[Match]
Name=wg0
[Address]
Address=10.0.0.123/8
/etc/systemd/network/eno1.network
[Match]
Name=eno1
[Network]
Address=192.168.130.123/24
Gateway=192.168.130.1
Like this?
Last edited by Swiggles (2019-10-09 17:08:08)
Offline
Sorry, wrong line pasted, I meant:
10.0.0.0/8 dev wg0-dev scope link
so "via" part is omitted.
Offline
What I noticed just now is that the syntax is specified without spaces in the docs of systemd. Maybe that's the problem here? Now we did a full turn I was thinking your original post is already the likely solution unless it is ommited, because there should already be an implicit route.
Could you please show the current config, output of "ip route" and see if there are any journal entries?
Offline