Skip to content

Instantly share code, notes, and snippets.

@Cryptophobia
Created February 13, 2020 16:10
Show Gist options
  • Save Cryptophobia/ab19da8440e00fde1f8dfbd8a43f222a to your computer and use it in GitHub Desktop.
Save Cryptophobia/ab19da8440e00fde1f8dfbd8a43f222a to your computer and use it in GitHub Desktop.
/etc/NetworkManager/dispatcher.d/99vpn-ipv6-switch
#!/bin/sh
# Network Manager Dispatcher Hook:
# enables/disables ipv6 on vpn-down/vpn-up respectively
# Args
INTERFACE="$1"
ACTION="$2"
case $ACTION in
vpn-up)
# vpn connected; disable ipv6
sysctl -w net.ipv6.conf.all.disable_ipv6=1
;;
vpn-down)
# vpn disconnected; enable ipv6
sysctl -w net.ipv6.conf.all.disable_ipv6=0
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment