How to Disable IPv6 on CentOS
IPv6 is the next-generation internet protocol that provides a larger address space compared to IPv4. However, there may be situations where you need to disable IPv6 on your CentOS server. Disabling IPv6 can help resolve compatibility issues or improve network performance. This guide provides two methods to disable IPv6 on CentOS: using sysctl and using the kernel boot option. By following these steps, you can effectively disable IPv6 on your CentOS system.
Method 1: Disable IPv6 Using sysctl
Open the sysctl configuration file /etc/sysctl.d/90-ipv6.conf using the following command:
Add the following lines to the file and save it:
Apply the changes by running the following command:
To verify that IPv6 is disabled, use the following command:
If the command does not return any output, it means that IPv6 has been disabled on all your network interfaces.
If you are using CentOS 8 with Network Manager, some network interfaces may still use IPv6 after a system reboot. To completely stop using IPv6, proceed to Method 2.
Method 2: Disable IPv6 Using the Kernel Boot Option
Open the default GRUB configuration file
/etc/default/grubusing the following command:
Locate the line that begins with
ipv6.disable=1to the existing parameters. The line should look like this:
Save and exit the configuration file.
Update the GRUB configuration files by running the following commands:
Reboot your CentOS machine for the changes to take effect:
After the reboot, use the following command to verify whether IPv6 is disabled:
If no IPv6 addresses are displayed, it indicates that IPv6 has been successfully disabled.
Disabling IPv6 on CentOS can be necessary in certain scenarios. By following the methods outlined in this guide, you can effectively disable IPv6 on your CentOS system. Choose the method that best suits your requirements and verify the success of the disabling process. Disabling IPv6 can help resolve compatibility issues and improve network performance if IPv6 is not required in your environment.
Created: May 29, 2023 00:53:18