Disabling IPv6 on Ubuntu is fairly easy. But first we should ask the question “why would we want to be able to disable IPv6?”

Even though IPv6 is the future, this is not the ultimate solution for many systems. This is due to the fact that numerous systems and applications still depend on upon IPv4 and are not compatible yet with IPv6. While the systems may someday become compatible with IPv6, this will take time to come about.

For example, if a repository supports IPv6, then the APT package manager will connect to that repository via IPv6 regardless of whether or not your ISP supports IPv6. This can be seen in the following screenshot below.

I personally believe that you should fix the network layer issues to enable IPv6 support. However if you still wish to disable IPV6 on Linux/Ubuntu, please follow the steps below:

  1. Open Terminal
  2. Enter gksudo gedit /etc/sysctl.conf and open the configuration file and add the following lines at the end
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
  1. After entering the above, run
    $ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If you receive a report of ‘1’, this means that you have disabled IPv6. If it reports ‘0’ , then follow the additional steps below.

  1. Type in the command sudo sysctl -p and you will see this appear in the terminal.
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
  1. Repeat above the “Step 3” and it should now report ‘1’.

After this, you should have connectivity on your Ubuntu instance.