Created
September 14, 2021 20:45
-
-
Save willianantunes/2e04f91e5c03584543a313fe2b7051a7 to your computer and use it in GitHub Desktop.
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/bash | |
# https://askubuntu.com/a/1178685 | |
# Args | |
INTERFACE=$1 | |
ACTION=$2 | |
# Check if the OpenVPN interface will be indeed tun0! | |
if [ "$INTERFACE" = "tun0" ]; then | |
case $ACTION in | |
up) | |
for disabledProperty in $(sysctl -a | grep ipv6 | grep disable | sed 's/ \= 0/=1/'); do | |
sysctl -w "$disabledProperty" | |
done | |
;; | |
down) | |
for enabledProperty in $(sysctl -a | grep ipv6 | grep disable | sed 's/ \= 1/\=0/'); do | |
sysctl -w "$enabledProperty" | |
done | |
;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment