1

In most of the places I work, IPv6 is supported. For my research work I also have VPN access to the university. However, this university does not support IPv6, so IPv4 data is routed over the VPN when connected, but IPv6 is routed over my local router.

There are various websites (e.g. https://ieeexplore.ieee.org/) which provide certain content for universities, based on their IPs, without login or free of charge. Since these websites support IPv4 and IPv6, and Ubuntu/my browser prefers IPv6, I can't access the provided content even if I'm connected to the university VPN. This only works if I deactivate IPv6 (manually, e.g. by dropping the IPv6 ip address).

Is there any way to deactivate my computer's IPv6 using Network Manager when connecting to this specific VPN? Selecting "Disable" in the Network Manager's IPv6 settings, it disables IPv6 only for the University connection (which has no IPv6 either). How to globally disable/block IPv6 traffic while connected to this University VPN?

I'm using Ubuntu 19.04 with Network Manager.

  • The VPN provider should be taking care of this by either providing IPv6 (it's 2019 after all! there's no reasonable excuse anymore) or preventing its use while the VPN is connected. – Michael Hampton May 3 '19 at 12:09
1

Check your VPN interface with ifconfig. Denote your interface name.

Create a script in /etc/network/if-up.d, containing

#!/bin/sh

if [ "$IFACE" = "tun0" ]; then
  sysctl -w net.ipv6.conf.all.disable_ipv6=1
  sysctl -w net.ipv6.conf.default.disable_ipv6=1
fi

In case you use tap or another VPN interface replace the line

if [ "$IFACE" = "tun0" ]; then

with

if [ "$IFACE" = "tap0" ]; then

or

if [ "$IFACE" = "your_denoted_vpn_interface_name" ]; then

| improve this answer | |
  • 1
    to add it make the script executable - chmod +x /etc/network/if-up.d/script_name – enjoy Oct 9 '19 at 21:45
  • script name is sensitive—if you use whatever.sh it doesn't work, periods are forbidden. unfortunately this method doesn't restart my ipv6 once I turn off the VPN (not even with a parallel script setting the disable_ipv6 options to 0 on ifdown). for now I have to restart wifi to get an ipv6 back. – melissa_boiko Nov 30 '19 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.