How to Disable IPv6 on Ubuntu Linux?

IPv6, or the Internet Protocol Version Six, is one of the latest active protocols on the Internet. It’s an identification and communication protocol for finding the DNS addresses on the internet. It was developed in 1998 to replace the IPv4 protocol.

As of now, IPv4 is still prominently used, but the use of IPv6 is increasing day by day. This protocol is very safe and secure and comes with 128-bit addresses. Instead of the 32-bit address range of IPv4, it provides a better address range to cover a large number of IPs.

As of now, the IPv6 adoption rate is 44.97% on 10th September 2024. You can see the live tracking of the adoption percentage on Google. As the adoption rate is low and it has a higher address range, there can be some issues that surround the IPv6.

The slower speeds and the higher latency in certain cases are some of the common issues with this protocol. This is very common when connected to Wireless Networks, as the WiFi Speeds slow down on the connected devices. Hence, people might have to Disable IPv6 on Ubuntu or other Linux distros. It’s quite easy to disable IPV6 on Linux Ubuntu 22.04, 24.04 and other distributions.

Be it the Linux servers or the Desktops, Disabling IPv6 is the sensible option. I’ve disabled it on my Ubuntu system and want to show you how to do the same. Just follow the methods shared here, and you will be able to disable IPv6 in Linux.

How Do I Completely Disable IPv6 on Ubuntu?

This tutorial is meant for the advanced users only. If you know the reason and severity of this issue, then you should proceed with these methods. Otherwise it can cause other problems.

Method #1 – Disable IPv6 using Sysctl

Systemctl is a core tool in Uuntu, which provides numerous features for the system mangemenr. You can disable or enable the IPv6 Protocol using the same. Here are the exact steps to guide you through this method.

  • As Systemctl has to be opened in the Terminal, press “Ctrl + Alt + T” to open Terminal. Now, type the following command to see if the IPv6 is enabled in your system or not.
ip a
ipv6 disable ubuntu systemctl 1
  • If you see the IPv6 address at the end of the output, then you must know that it’s enabled. Now, you can move to the next step.
  • In this step, you have to enter the following three commands one after another. These are systemctl commands that disable the protocol. Make sure to provide a Sudo password to let these commands execute.
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
ipv6 disable ubuntu systemctl 2
  • After entering these three commands, the IPv6 will be disables. You can check it by typing following command.
ip a
ipv6 disable ubuntu systemctl 3

You will see that the version 6 protocol is disabled now.

The only downside to the Systemctl method is that it only disables the protocol temporarily. After you reboot the system, it will reset the changes and enable the IPv6 by default. To permanently fix this issue, you should edit the sysctl.conf file. Follow these steps.

  • Open the File Manager on your PC and then locate the file in the “/etc/sysctl.conf” folder.
  • You have to open it with the Sudo privileges. You can use any of the popular text editors like Vim or Sublime Text to open the file. Paste the following lines in the file and save with Sudo privileges.
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
  • After that, type the following command to let the changes take effect.
sudo sysctl -p
  • Now, reboot the system and see if the IPv6 is still active. It will not be active in most cases. If you are still seeing it active, then you should follow the second method.

Method #2 – Disable IPv6 using GRUB

Changing the GRUB file is a permanent solution for disabling the Internet Protocol Version 6. Here are the exact steps for advanced users.

  • First of all, open File Manager and navigate to the “/etc/default/grub” path. You can do that through the Address Bar.
  • Also, you can open the file through Terminal with the following command.
sudo less /etc/default/grub
  • You have to provide sudo password to open the file. I will open the file in default text editor in Terminal. You have to use the arrow keys to navigate and must have knowledge of command line file editing.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"
  • After pasting these lines in the file, you have to save the same. After saving, you have to tyep the following command to let the system know about Grub changes.
sudo update-grub
  • The grub file will be updated in the system, and you can reboot the system to let the changes take effect.

That’s all you had to do to disable the IP6 protocol on your Ubuntu 22.04 or higher versions. This can work on all other Ubuntu-based distributions like Elementary OS, Zorin OS, Linux Minute and others.

How to Enable IPv6 Again?

The simplest way to enable IPv6 again is to undo all the changes. You can follow these steps to re-enable the IPv6 again.

For Method #1 Users –

In the Terminal Window, paste the following commands one by one. This will enable the IPv6 till your system reboots. This is a temporary solution if you want to test something.

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

If you want to permanently enable, then edit the “/etc/sysctl.conf” file and add the following parameters.

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

After saving the sysctl.conf file, you have to let the system know of the udpates. Enter the following command.

sudo sysctl -p

That’s it. IPV6 is Enabled in Ubuntu.

For Method #2 Users –

If you’ve updated the GRUB file to disable this Internet Protocol, then you have to undo all the changes. Open the GRUB file as you’ve done in the Method #2 and replace the following parameters.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Save the file and let system know that the GRUB file has been updated.

sudo update-grub

The grub will now update and just reboot to let the changes take effect.

Conclusion

IPv6 is a great protocol for speed and security. However, the incompatibility with a wide range of applications and slow internet speeds can cause people to disable it. As I myself used IPv4, I tried my best to share a detailed tutorial on Disabling IPv6 on Linux Ubuntu and related distributions. It’s common to face problems if you are a first-timer. If you face issues, feel free to ask for help in the comments.

Posted In : ,

Leave a Reply

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

Swaraj Nandedkar