How to Disable IPv6 on Ubuntu Linux

Home » Guides » How to Disable IPv6 on Ubuntu Linux
Guides, How to No Comments
No votes yet.
Please wait...


As IPv4 is slowly being depleted and replaced with IPv6 to provide internet users all over the planet with enough IP addresses for the upcoming future, a lot of platforms and applications have not yet transitioned to support IPv6, leading to several problems. For example, VPN users are subjected to IP and DNS leaks. Also, Ubuntu Linux users have reported connection problems while using IPv6. It is even worse with Linux users who have IPv6 addresses and also use VPN services.

Not only do VPN IPv6 Linux users are vulnerable to IP leakage while surfing the web, but they also suffer from a significant slow down in their internet connection. IPv6 leakage means that instead of being hidden and protected on the internet by your VPN provider, your real IP is leaked out on the internet as if you are not using a VPN at all. This leads to exposure of your personal data as well as browsing activities. Furthermore, if you are attempting to bypass a geo-restricted destination, you will not be able to even with VPN.

In this case, you either need to subscribe to a VPN that supports IPv6, or at least comes with an IPv6 leaks protection or a kill switch, or you need to disable IPv6 altogether from your Ubuntu Linux system in order to avoid IP leaks and stay secured online.

Disabling IPv6 on Linux 16.04 and 17.04

In order to terminally disable IPv6 on Linux, some changes are needed to be made on Linux Kernel parameter:

1- Edit the 99-sysctl.conf file.

sudo nano /etc/sysctl.d/99-sysctl.conf

2-  Next, you need to copy and paste the following commands at the bottom:

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

3- Then, you need to save and close the file.

4- In order to load the changes above, you need to execute the command below:

sudo sysctl -p

5- Run the following command. Note that if you the number “1”, it means that IPv6 has been successfully disabled.

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

You have successfully disabled IPv6 on Linux, congratulations.