Ubuntu Disable IPv6

Ubuntu Disable IPv6
IPv6 or Internet Protocol Version 6 is the latest version of the IP protocol after IPv4. IPv6 overcomes many of the limitations of IPv4. One of the main problem with IPv4 is that it uses 32 bit addresses. So, we can have 2^32 or about 4 billion unique IP addresses. Because of that we are almost out of IPv4 addresses. To overcome this problem IPv6 came out and IPv6 uses 128 bit addresses. So, we can have about 2^128 or 340,282,366,920,938,463,463,374,607,431,768,211,456 IPv6 addresses. It’s a lot of IP addresses. It’s said that even if we assign an IPv6 addresses to every electronic device and every people, the IPv6 addresses still won’t run out.Enough of this jabbering about IPv6. The real question is, do you need IPv6 on your computer? Well, if you’re on a private network or let’s say, on your home with a few computers, laptops and smartphones, IPv6 is an overkill. IPv4 is much simpler in these scenarios.

Keeping IPv6 enabled means you have to configure your firewall for IPv4 as well as IPv6. If you fail to do so, then your open IPv6 ports will be a security risk for you. So, that’s a lot of extra work and extra threats unless you’re using IPv6.

So, you might be thinking, if I am not using IPv6, why am I keeping it enabled? Well, you don’t have to. On Ubuntu, you can disable IPv6 very easily.

In this article, I am going to show you how to disable IPv6 on Ubuntu. So, let’s get started.

Disabling IPv6:

The easiest and most effective way to disable IPv6 is to disable it on system boot using kernel boot parameters. If you pass ipv6.disable=1 boot parameter when you boot into Ubuntu, IPv6 will be disabled completely.

We are not manually doing that every time we start our computer of course. So, you have to put ipv6.disable=1 as a default boot parameter.

To do that, first, edit the /etc/default/grub configuration file with the following command:

$ sudo nano /etc/default/grub

The configuration file should be opened. There are two lines that you have to edit, GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX as marked in the screenshot below.

Now, add ipv6.disable=1 in GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX as shown in the screenshot below. Once you’re done, save the file by pressing <Ctrl> + x followed by y and <Enter>.

Now update the GRUB bootloader configuration files for the changes to take effect with the following command:

$ sudo update-grub2

GRUB bootloader configuration files should be updated.

Before you restart your computer, I just want to show you that IPv6 is enabled for now.

To check whether IPv6 is enabled, you can run the following command:

$ test -f /proc/net/if_inet6 && echo "IPv6 is enabled."
|| echo "IPv6 is disabled."

As you can see, IPv6 is enabled at the moment.

Now, restart your computer with the following command:

$ sudo reboot

Once your computer boots, IPv6 should be disabled as you can see in the screenshot below.

$ test -f /proc/net/if_inet6 && echo "IPv6 is enabled."
|| echo "IPv6 is disabled."

So, that’s how you disable IPv6 on Ubuntu. Thanks for reading this article.

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *