WireGuard

https://elou.world/en/tutorial/wireguard

chown root:systemd-network /etc/systemd/network/99-*.netdev
chmod 0640 /etc/systemd/network/99-*.netdev

/etc/systemd/network/30-wg.netdev

[NetDev]
Name = wg1
Kind = wireguard
Description = wg client for smex.dk

[WireGuard]
PrivateKey = <private-key>

[WireGuardPeer]
PublicKey = <peer-public-key>
AllowedIPs = 172.16.20.0/24, 172.16.0.0/24, 10.0.20.0/24, 10.0.10.0/24
Endpoint = <endpoint-address>
PresharedKey = <preshared-key>
PersistentKeepalive = 25

/etc/systemd/network/30-wg.network

[Match]
Name = wg1

[Network]
Address = 172.16.20.10/32

[Route]
Gateway = 172.16.20.1
Destination = 172.16.20.0/24
GatewayOnlink = true

[Route]
Gateway = 172.16.20.1
Destination = 172.16.0.0/24
GatewayOnlink = true

[Route]
Gateway = 172.16.20.1
Destination = 10.0.20.0/24
GatewayOnlink = true

[Route]
Gateway = 172.16.20.1
Destination = 10.0.10.0/24
GatewayOnlink = true

Last modified: Mon May 13 11:51:34 2024