WireGuard systemd-networkd routing configuration

jugs jugs at protonmail.ch
Thu Feb 8 20:27:16 CET 2018


Hey guys,

Given WireGuard support is in systemd 237, it may be preferable to have systemd manage the interfaces on some distros.

I'm having issues recreating the routing table with systemd-networkd to do `AllowedIPs=0.0.0.0/0` aka setting the default route for all system traffic to use the wg0 interface. I would appreciate some suggestions on how to change my config to make this happen. I've tried various combinations for the dhcp.network and the wg.network with no success.

Below is my equivalent config as to having my wg.conf with `AllowedIPs=192.168.100.0/24`:

[me at host network]$ pwd
/etc/systemd/network
[me at host network]$ ll
total 12K
-rw-r----- 1 root systemd-network 300 Feb  7 12:00 25-wireguard.netdev
-rw-r----- 1 root systemd-network  60 Feb  7 12:00 40-dhcp.network
-rw-r----- 1 root systemd-network 100 Feb  7 12:00 50-static-wg.network
[me at host network]$ cat 25-wireguard.netdev
[NetDev]
Name=wg0
Kind=wireguard

[WireGuard]
PrivateKey=ABCDEFG=
FwMark=51820

[WireGuardPeer]
PublicKey=GHIJKLMNOP=
AllowedIPs=0.0.0.0/0
Endpoint=1.2.3.4:51820

[me at host network]$ cat 40-dhcp.network
[Match]
Name=eth0

[Network]
DHCP=yes

[DHCP]
UseDNS=no

[me at host network]$ cat 50-static-wg.network
[Match]
Name=wg0

[Network]
Address=192.168.100.2/32
DNS=192.168.100.1

[Route]
Destination=192.168.100.0/24

-jugs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20180208/b83d8716/attachment.html>


More information about the WireGuard mailing list