Skip to content

Instantly share code, notes, and snippets.

@fouwels
Last active November 14, 2022 14:12
Show Gist options
  • Save fouwels/8e9f06e4213a551405f31e6470164fce to your computer and use it in GitHub Desktop.
Save fouwels/8e9f06e4213a551405f31e6470164fce to your computer and use it in GitHub Desktop.
wireguard interface systemd "service"
[Unit]
Description=Initialise and load wireguard interface %i
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link add %i type wireguard
ExecStart=/sbin/ip addr add 10.200.1.100/24 dev %i
ExecStart=/usr/bin/wg setconf %i /etc/wireguard/%i.conf
ExecStart=/sbin/ip link set dev %i up
ExecStopPost=/sbin/ip link del %i
ExecReload=/usr/bin/wg setconf %i /etc/wireguard/%i.conf
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment