How to Disable IPv6 on Ubuntu 24.04

IPv6 is the next generation of internet addresses since IPv4 is almost fully occupied. Due to the increase in IPv6 adoption, many systems, including Ubuntu, maintain IPv6 and IPv4 addresses simultaneously, ensuring compatibility, seamless connectivity, and future-proofing.

To avoid network complexity and compatibility issues, some system administrators keep the IPv6 disabled. In this guide, I will explain why it becomes necessary to disable IPv6 and how to disable it using various methods on Ubuntu 24.04 Noble Numbat. 

Reasons to Disable IPv6

Although IPv6 is the future of internet addresses, many users, including system administrators, keep it disabled for various reasons. Some key reasons are listed below:

1. Network Troubleshooting

Network troubleshooting is one of the common reasons to disable IPv6. Disabling the IPv6 can be useful for testing network issues. 

2. Compatibility Problems

Many older systems and network equipment still use the IPv4, so to avoid any compatibility issues, IPv6 is kept disabled. 

3. DNS Slow Down

In some networks, the DNS performance can be slowed down due to IPv6 responses. In that case, disabling it can benefit the network.

4. To Avoid Network Complexities

Having both IPv4 and IPv6 enabled at the same time increases the network management complexities. Therefore, it is preferred to disable IPv6.

5. Security Reasons

Many system administrators lack expertise in IPv6 configuration and security settings because of its complexities. If the IPv6 is not configured properly, it can cause many security vulnerabilities. 

6. Personal Preference

Many users still prefer to maintain servers using IPv4 only because it is easier to configure and manage. Therefore, disabling IPv6 helps them securely manage the network without complexity.

Disable IPv6 on Ubuntu

There are different methods to turn off the IPv6 on Ubuntu. 

  1. Disable IPv6 by Configuring Sysctl File
  2. Disable IPv6 by Configuring Grub File
  3. Temporarily Disable IPv6 through sysctl Command

1. Disable IPv6 Through Sysctl File

The sysctl is a command line utility used to modify the kernel parameters at runtime. 

Before disabling the IPv6, let’s check the current IPv6 addresses.

ip a | grep inet6
Disable Ipv6 A

The output shows the IPv6 and their scope.

To turn off the IPv6 functionality on Ubuntu using sysctl.conf file; follow the steps given below:

Step 1: Open sysctl.conf File

The sysctl.conf file is located in the /etc directory. Access it using the terminal-based text editor with sudo privileges.

sudo nano /etc/sysctl.conf
Disable Ipv6 B

Step 2: Add the Network Configuration to Disable IPv6

Insert the network settings at the bottom of the sysctl.conf file to control the behavior of IPv6.

Disable Ipv6 C


  • net.ipv6.conf.all.disable_ipv6=1 setting disabling the IPv6 for all the network interfaces. 
  • net.ipv6.conf.default.disable_ipv6=1 setting is disabling IPv6 for the default interface.
  • net.ipv6.conf.lo.disable_ipv6=1 setting is disabling the IPv6 for the loopback interface which is primarily used to communicate within the system.

Now, after making the desired edits save the file and close the editor.

Step 3: Apply Changes by Reloading the sysctl.conf File

Reload the sysctl.conf file to read the changes and apply them.

sudo sysctl -p
Disable Ipv6 D

Restart the network service.

sudo systemctl restart NetworkManager

Step 4: Verify

Now, verify whether the IPv6 is disabled or not using ip a command.

ip a | grep inet6
Disable Ipv6 E

The output shows no IPv6 address, which indicates that IPv6 is successfully disabled on Ubuntu 24.04.

The above method permanently disables the IPv6 on Ubuntu, to reactivate it, read the section given below:

Reactivate IPv6 through Sysctl File

To reactivate the IPv6, first, remove the kernel parameters from Sysctl file added in the previous section. 

Disable Ipv6 F

Then reload Sysctl file using sysctl -p command. Even after restarting the NetworkManager, you may not see the modifications. You need to reboot the system to reactivate the IPv6 back on Ubuntu.

2. Disable IPv6 Through Grub File

To manage the boot process on Linux distributions like Ubuntu, the Grub program, also known as GNU Grand Unified Bootloader, is used. The Grub configuration file can also be used to pass the kernel parameters and disable the IPv6 on boot.

To disable the IPv6 on Ubuntu through the Grub configuration file go through the step-by-step instructions mentioned below.

Step 1: Open the Grub Configuration File

The Grub settings file is located in the /etc/default directory. Open the file using any terminal-based text editor with sudo privileges.

sudo nano /etc/default/grub
Disable Ipv6 G

Step 2: Add the Kernel Parameters to Disable IPv6

GRUB_CMDLINE_LINUX_DEFAULT is the option that will be used to set the kernel parameters in the Grub file. Note that this option is already present in the Grub file without parameters.

Pass ipv6.disable=1 to the GRUB_CMDLINE_LINUX_DEFAULT option.

Disable Ipv6 H

Save the file and exit the text editor. 

Step 3: Apply Changes by Updating the Grub File

Now, to apply the modifications made in the Grub settings, update the Grub file.

sudo update-grub
Disable Ipv6 I

The output shows that the changes have been applied. 

Step 4: Reboot the System

Restart the system using the reboot command.


Step 5: Verify

For verification, check the IPv6 using the ip a command.

ip a | grep inet6
Disable Ipv6 J

The output indicates that the IPv6 has been successfully disabled through the Grub file.

This method also permanently disables the IPv6 on Ubuntu, to reactivate it, read the section given below:

Reactivate IPv6 through Grub File

To enable the IPv6 again, set ipv6.disable=0 in the Grub file and update it using the update-grub command. 

Disable Ipv6 K

After that restart the system and verify using ip a command. 

3. Disable IPv6 Temporarily

If the purpose of disabling the IPv6 on Ubuntu is to troubleshoot the network then it can also be temporarily disabled using sysctl command. 

Step 1: Write Kernel Parameters to Disable IPv6 using sysctl Command

Run the commands mentioned below to disable the IPv6 temporarily.

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

The –write can also be replaced with the -w flag.

Step 2: Verify using ip a Command

To verify use the ip a command with grep inet6.

ip a | grep inet6
Disable Ipv6 L

The output shows that the IPv6 has been disabled. On restarting the system, the IPv6 will be enabled again.

Reactivate the Temporarily Disabled IPv6 

To immediately reactivate the IPv6, set the kernel parameters equal to 0.

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

And verify it using ip a command.

Disable Ipv6 M

Disable IPv6 Responses on Bind 9

If you are using Bind 9 for DNS management then many times DNS performance slows down due to IPv6 responses. In such a situation, you can disable IPv6 on Bind 9.

Step 1: Open the Bind 9 Options Configuration File

The named.conf.options file plays a crucial role in configuring the Bind DNS server. By default, the Bind 9 listens to both IPv4 and IPv6 traffic. To make it for IPv4 only open the Bind 9 options file.

sudo nano /etc/bind/named.conf.options
Disable Ipv6 N

Step 2: Change listen-on-v6 Directive

Find line listen-on-v6 { any; }; and modify it to listen-on-v6 { none; };.

Disable Ipv6 O

Save the file and quit the editor. 

Step 3: Reload the Bind 9 Service

Reload the Bind 9 server.

sudo rndc reload

And reload the Bind 9 service using the systemctl command to apply the changes.

sudo systemctl restart bind9.service

Step 4: Verify

To verify, use the netstat command and grep named.

sudo netstat -tulpn | grep named

In the above command -t and -u are used to list the TCP and UDP connections. The -l, -p, and -n flags are used to list display listening sockets, process IDs, and numerical addresses respectively. At the same time, the output is piped to grep named to filter the named processes only.

Disable Ipv6 P

In the output you can see the Bind is only listening to the IPv4 and IPv6 has been disabled. 

To reactivate the IPv6 for Bind 9, replace listen-on-v6 { none; }; with listen-on-v6 { any; }; in the options file.

Why do I have both IPv4 and IPv6 addresses on Ubuntu

Ubuntu supports both IPv4 and IPv6, which is also termed as operating in dual-stack mode. By having both network addresses, Ubuntu can efficiently manage traffic from either IPv4 or IPv6. Additionally, having IPv4 ensures compatibility with networks and devices that still use them.


There are many reasons behind disabling IPv6 on Ubuntu, however primarily, it is disabled to troubleshoot networks. The IPv6 can be permanently disabled by modifying the sysctl.conf and grub files. To temporarily disable IPv6 on Ubuntu the sysctl command can be used with the –write or -w flag. This guide explains all the methods to disable and reactivate the IPv6 on Ubuntu 24.04 Nobel Numbat.