Skip to content

Instantly share code, notes, and snippets.

@TheDcoder
Created December 12, 2025 11:01
Show Gist options
  • Select an option

  • Save TheDcoder/85e1ec99a31180e20ba8e4896024f265 to your computer and use it in GitHub Desktop.

Select an option

Save TheDcoder/85e1ec99a31180e20ba8e4896024f265 to your computer and use it in GitHub Desktop.
#!/usr/bin/fish
# NetworkManager-dispatcher script to disable IPv6 for WireGuard VPN connections
#
# The `vpn-{up,down}` events are not sent for WG connections, so we have to use
# pattern matching on the interface on generic `up/down` events, by default this
# script matches any interface which starts with `wg`.
#
# Just install this script in `/etc/NetworkManager/dispatcher.d` to use it.
# (Don't forget to install fish shell since this is a fish script, not bash)
set DISABLE_PARAM /proc/sys/net/ipv6/conf/all/disable_ipv6
function main -a IFACE EVENT
if not string match -q 'wg*' $IFACE
return
end
switch $EVENT
case up
echo 1 > $DISABLE_PARAM
case down
echo 0 > $DISABLE_PARAM
end
end
main $argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment