Skip to content

Instantly share code, notes, and snippets.

@willianantunes
Created September 14, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willianantunes/2e04f91e5c03584543a313fe2b7051a7 to your computer and use it in GitHub Desktop.
Save willianantunes/2e04f91e5c03584543a313fe2b7051a7 to your computer and use it in GitHub Desktop.
#!/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