#!/bin/bash ## ## Reloads Wireguard tunnel when an interface change happens ## Intended for use with always active full tunnels ## Place in /etc/NetworkManager/dispatcher.d, change permissions ## to 755 and enter your interface name to WG_INTERFACE ## (e.g. WG_INTERFACE='wg0') ## WG_INTERFACE='' if [[ "$1" != "$WG_INTERFACE" ]] && [[ "$2" == "up" ]]; then echo "running $0" | systemd-cat -t nm-dispatcher sleep 2 nmcli conn up $WG_INTERFACE fi exit 0