I cannot find any answers for this, so if anyone here can point me in the right direction...

Edited for clarity

Ubuntu 18.04 with low latency kernel.

I get horrible download speeds at times, especially with Steam, but also other streaming sites. I have found that if I manually disable ipv6, I get advertised download / upload speeds on my isp connection. If it is not disabled, things become really slow in a short period of time (like 2 Kbps). When I use my vpn service, everything runs fast because it disables the ipv6 stack, then re-enables it upon closing the vpn connection.

However, I got tired of having to manually disable when not using the vpn, so I permanently disabled ipv6 via grub. This completely disabled my vpn service. Even their support staff were unable to help. So I changed everything back to the way it was.

I have since disabled ipv6 in my router, which has helped increase overall speed when the network stack is at default (ipv6 enabled). Having both the router and Ubuntu ipv6 disabled increases my speed by several Mbps up and down.

To recap - ipv6, when enabled by default, slows down my Internet connection, but disabling it and only having ipv4 running makes everything faster. Disabling ipv6 in both the router and the OS makes things Speedy Gonzales. Disabling ipv6 permanently via grub kills vpn access.

Is there a way to permanently disable ipv6 so it does not break my vpn? Or some type of desktop script that can disable it manually with a click?

Thanks in advance!

How I disable ipv6 manually (checked with ip a):

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

How I permanently disabled ipv6:

  • That's bizarre. It's almost certainly caused by your router, not your Ubuntu PC. Check for firmware updates for your router, or if it is very old, consider replacing it. – Michael Hampton Jun 4 at 2:46
  • Nope. Not the router. ipv6 is disabled on it and there is no issue there. – Syd Jun 4 at 12:36
  • Then it's almost certainly the router. You should reset that setting and re-enable IPv6 on it, or see my previous comment. – Michael Hampton Jun 4 at 14:37
  • Still not the router. I have edited my post to clarify things. Still won't be the router. – Syd Jun 5 at 14:32
  • Your description does clarify the issue more. It's either the router or the ISP. Since disabling IPv6 is not a reasonable option anymore, this should not be left in this state. – Michael Hampton Jun 5 at 17:06

There's a lot to unpack here about your issue, but since you only asked for a way to disable ipv6 permanently that doesn't interrupt the VPN service, simply add these lines to /etc/sysctl.conf at the end:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

This should work since your manual command did.

  • I did try that, but it did not want to stay after a reboot. However, I did find a solution, which I will post. – Syd Jun 12 at 18:33

I found a solution that works flawlessly. Even through reboots. And it is automatic.

From Ubuntu Forums:

Use the ifconfig command to determine your network interface.

Then create a script in the folder /etc/network/if-up.d. The idea would be that it should disable ipv6 when connected outside the VPN.

For example something like:


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

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.