Created
July 16, 2019 06:08
-
-
Save braincow/b48767d4d93a3527c2cb0ff952a8cfa0 to your computer and use it in GitHub Desktop.
NetworkManager dispatcher script for disabling ipv6 when VPN is enabled.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Network Manager Dispatcher Hook: | |
# enables/disables ipv6 on vpn-down/vpn-up respectively | |
# | |
# Copyright (c) 2017 ooknosi | |
# Apache License 2.0 | |
# Args | |
INTERFACE="$1" | |
ACTION="$2" | |
case $ACTION in | |
vpn-up) | |
# vpn connected; disable ipv6 | |
sysctl -w net.ipv6.conf.all.disable_ipv6=1 | |
### UNCOMMENT AND EDIT BELOW IF NECESSARY | |
## add pi-hole nameserver | |
#echo -n "nameserver 192.168.1.1" | /sbin/resolvconf -a "tun0.openvpn" | |
### UNCOMMENT AND EDIT ABOVE IF NECESSARY | |
;; | |
vpn-down) | |
# vpn disconnected; enable ipv6 | |
sysctl -w net.ipv6.conf.all.disable_ipv6=0 | |
### UNCOMMENT AND EDIT BELOW IF NECESSARY | |
## remove pi-hole nameserver | |
#/sbin/resolvconf -d "tun0.openvpn" | |
### UNCOMMENT AND EDIT ABOVE IF NECESSARY | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment