gistfile1.txt
· 480 B · Text
Sin formato
#!/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
| 1 | #!/bin/bash |
| 2 | |
| 3 | ## |
| 4 | ## Reloads Wireguard tunnel when an interface change happens |
| 5 | ## Intended for use with always active full tunnels |
| 6 | ## Place in /etc/NetworkManager/dispatcher.d, change permissions |
| 7 | ## to 755 and enter your interface name to WG_INTERFACE |
| 8 | ## (e.g. WG_INTERFACE='wg0') |
| 9 | ## |
| 10 | |
| 11 | WG_INTERFACE='' |
| 12 | |
| 13 | if [[ "$1" != "$WG_INTERFACE" ]] && [[ "$2" == "up" ]]; then |
| 14 | echo "running $0" | systemd-cat -t nm-dispatcher |
| 15 | sleep 2 |
| 16 | nmcli conn up $WG_INTERFACE |
| 17 | fi |
| 18 | |
| 19 | exit 0 |