Skip to content

Instantly share code, notes, and snippets.

@mortn
Created March 15, 2025 15:53
Show Gist options
  • Save mortn/12321212fca47b8aef3cff0b60f90783 to your computer and use it in GitHub Desktop.
Save mortn/12321212fca47b8aef3cff0b60f90783 to your computer and use it in GitHub Desktop.
Wireguard setup with plain systemd networkd
# /etc/systemd/network/10-wgsrv.netdev
[NetDev]
Name=wgsrv
Kind=wireguard
Description=WireGuard wgsrv
[WireGuard]
ListenPort=51820
PrivateKeyFile=[path-to-private-key]
[WireGuardPeer]
# client 1
PublicKey=[client 1 public key]
AllowedIPs=0.0.0.0/0
# /etc/systemd/network/10-wgsrv.network
[Match]
Name=wgsrv
[Network]
Address=10.77.0.1/24
[Interface]
Address = 10.77.0.53/24
DNS = [IP of local DNS server], [optional search domain]
PrivateKey = [client 1 private key]
[Peer]
PublicKey = [wgsrv public key]
AllowedIPs = 0.0.0.0/0
EndPoint = [public endpoint of the WG server, IP or hostname]:[port number]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment