How to Disable IPv6 in CentOS 8?

In today's modern world, the utilization of the Internet is essential for many businesses and individuals alike. The Internet Protocol (IP) is a fundamental communication protocol that is used to connect devices over the internet. Internet Protocol Version 6 (IPv6) was introduced in 1998 as an improvement over IPv4 and has since become more widely adopted.

Explanation of what IPv6 is and why someone may want to disable it

IPv6 provides several advantages over its predecessor, including a larger address space, improved security, and better network performance. However, there are situations where disabling IPv6 may be necessary. For example, some applications or devices may not function properly with IPv6 enabled or may have compatibility issues with older operating systems that do not support IPv6.

Brief overview of the steps involved in disabling IPv6 in CentOS 8

CentOS 8 is a popular Linux distribution used by many businesses and individuals for web servers and other network infrastructure. Disabling IPv6 on CentOS 8 involves several steps, including checking the current status of IPv6, disabling it temporarily or permanently through commands or configuration files modification depending on one's requirements.

This article will provide detailed instructions on how to disable IPv6 in CentOS 8 effectively. We will also cover some troubleshooting tips that can help resolve common issues that you might encounter when attempting to disable this protocol.

Checking the Current Status of IPv6

IPv6 is a network protocol that is designed to replace IPv4, which is the current standard for internet communications. Before disabling IPv6, it's important to check whether it's currently enabled or disabled on your system. There are two commands that you can use to check whether IPv6 is enabled or disabled on CentOS 8: the ip command and the sysctl command.

Using the ip Command to Check if IPv6 is Enabled or Disabled

enabled or disabled using this command, open a terminal window and type in: ```

ip a | grep inet6 ``` This will display all network interfaces along with their associated IP addresses.

If any of these IP addresses have "inet6" in them, then you know that IPv6 is enabled on your system. Otherwise, if no IP address contains "inet6", then it means that IPv6 is currently disabled.

Using the sysctl Command to Check if IPv6 is Enabled or Disabled

The sysctl command allows you to view and modify kernel parameters in real time. To check whether IPV 8 has been enabled using this command, open a terminal window and type in: ```

sysctl net.ipv6.conf.all.disable_ipv6 ``` If this output displays "net.ipv4.conf.all.disable_ipv4 = 1", then it means that IPV 8 has been successfully disabled.

On the other hand, if it displays "net.ipv4.conf.all.disable_ipv4 = 0", then IPV 8 has not been successfully disabled yet. Now that we've checked whether IPV 8 is enabled or not, we can proceed to disabling it.

Disabling IPv6 Temporarily

There may be situations where you need to disable IPv6 temporarily. This could include troubleshooting network connectivity issues or running applications that are not compatible with IPv6. Disabling IPv6 temporarily can be done using the sysctl command.

Using the sysctl command to temporarily disable IPv6

The sysctl command is used to modify kernel parameters at runtime. In order to temporarily disable IPv6, you can set the value of "net.ipv6.conf.all.disable_ipv6" to 1. This can be done with the following command −

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 This will immediately disable IPv6 for all network interfaces on your system.

Testing if IPv6 has been successfully disabled

In order to confirm that you have successfully disabled IPv6, you can use the "ip" command again. If everything has been configured correctly, you should see "inet" addresses listed for your network interfaces instead of "inet6". You can also use tools such as ping or traceroute to test network connectivity and ensure that everything is working as expected.

It's important to note that disabling IPv6 temporarily can result in issues with certain applications or services that rely on it. If you are experiencing problems after disabling IPv6, it may be necessary to re-enable it and investigate other potential causes of your connectivity issues.

Disabling IPv6 Permanently

Editing the grub configuration file to permanently disable IPv6

To permanently disable IPv6 in CentOS 8, we need to edit the GRUB configuration file. The GRUB2 bootloader is used by CentOS 8 and it controls the boot process of your Linux system. To get started, open a terminal and become root by typing "sudo su".

Next, we will edit the "/etc/default/grub" file using a text editor such as Nano or Vim. Find the line that starts with "GRUB_CMDLINE_LINUX" and add "ipv6.disable=1" at the end of that line.

This tells the kernel to disable IPv6 during boot time. Here's an example −

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet ipv6.disable=1" Save your changes and exit the text editor.

Updating GRUB configuration after editing

Once you've edited the "/etc/default/grub" file, you need to update your GRUB configuration using the command "grub2-mkconfig -o /boot/grub2/grub.cfg". This will create a new GRUB configuration file based on our changes made in "/etc/default/grub".

If you encounter any errors during this step, it may be due to incorrect syntax in your GRUB configuration file. Double-check that you have entered everything correctly before trying again.

Testing if IPv6 has been successfully disabled

After updating your GRUB configuration file, reboot your computer for these changes to take effect. Once you've booted back up into CentOS 8, use one of the methods mentioned earlier (using ip command or sysctl command) to check if IPv6 has been successfully disabled. If everything went smoothly, you should see that IPv6 is now disabled.

Remember, disabling IPv6 may cause some network applications to not work correctly, so it is important to test your network connectivity after making these changes. Additionally, keep in mind that if you ever need to re-enable IPv6, simply remove "ipv6.disable=1" from the "GRUB_CMDLINE_LINUX" line in "/etc/default/grub", update your GRUB configuration file again using "grub2-mkconfig -o /boot/grub2/grub.cfg", and reboot your system.

Troubleshooting Common Issues

Disabling IPv6 can sometimes cause network connectivity issues, which may require troubleshooting to resolve. Some common issues that may arise include −

Network Connectivity Problems

After disabling IPv6, some applications or services that rely on it may not function properly. This can result in network connectivity problems such as slow or no internet access or the inability to connect to certain websites. In such situations, it's important to check if any firewall rules are blocking traffic and ensure that the network configuration is correct.

Tips for Resolving Issues Related to Disabling IPV6

Here are some tips for resolving common issues related to disabling IPv6 −

  • Check Firewall Rules− ensure that the firewall rules are not blocking traffic related to ipv4.

  • Update Network Configuration− Check if the network configuration is correct and update it if necessary. This may involve checking if DHCP is enabled and reconfiguring the IP address manually.

  • Troubleshoot VPN Connections− if you use a vpn connection, ensure that it supports ipv4 and is configured correctly after disabling ipv6.

  • Rollback changes made with caution− If you encounter an issue while following this guide. Ensure you rollback changes made before proceeding with further troubleshooting as it might be unrelated but just coincidental

Disabling IPv6 in CentOS 8 can help resolve compatibility issues with certain applications or services. However, it's important to understand how this may impact your system's network connectivity and take appropriate measures to troubleshoot any resulting issues.


Throughout this guide, we have discussed the various steps that are involved in disabling IPv6 in CentOS 8. We started by introducing IPv6 and explaining the reasons why someone might want to disable it.

We then moved on to checking the current status of IPv6 on our system before proceeding with disabling it. We covered both temporary and permanent methods for disabling IPv6, including editing the grub configuration file to permanently disable it.

Furthermore, we also provided tips for troubleshooting common issues that may arise when trying to disable IPv6. Overall, disabling IPv6 in CentOS 8 is a straightforward process that can help improve network security and performance.

We hope that this guide has been helpful in providing you with the necessary information and steps required to successfully disable IPv6 on your system. For those who have followed this guide successfully, we encourage you to continue exploring ways to optimize your operating system's performance and security.

It is always essential to stay up-to-date with the latest developments in technology and best practices for securing networks. We wish you all the best on your journey towards a more secure computing environment!

Updated on: 10-Jul-2023


Kickstart Your Career

Get certified by completing the course

Get Started