## Connect to Wireguard interface automatically ## using NetworkManager. ## wg-quick@ -systemd services do not configure ## DNS properly when systemd-resolved is used ## resulting in DNS leaks and general issues, ## hence starting the interface via nmcli is ## necessary [Unit] Description=wg0 interface After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=nmcli conn up wg0 ExecStartPost=resolvectl flush-caches ExecStop=nmcli conn down wg0 ExecStopPost=resolvectl flush-caches RemainAfterExit=true [Install] WantedBy=default.target