IPv6 is the advanced version of the Internet Protocol (IP). This communication protocol gives an identification of operating systems over the Internet. The purpose of disabling IPv6 on CentOS is to prevent the system’s various issues such as “system compatibility”, “limited resources”, “security”, and “privacy”.
This tutorial will explain the step-by-step guidelines for disabling IPv6 on CentOS/ RHEL.
- Using sysctl Configuration File to Disable IPv6
- Using kernel Module to Disable IPv6
- Using sysctl Command to Disable IPv6
Method 1: Using sysctl Configuration File to Disable IPv6
One common method is to edit the sysctl configuration file related to IPv6 in the “/etc/sysctl.conf” file. Here are the steps to disable IPv6 using this method:
Step 1: Edit the sysctl Configuration File
Open a terminal and use the command “sysctl.conf” to edit the sysctl configuration file:
$ sudo nano /etc/sysctl.conf
Add the following lines to the file:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Save the changes to the file and close the editor.
Step 2: Apply the Changes
To apply the changes and configuration, the “sysctl” command is utilized with the “p” option that updates the kernel parameters:
$ sudo sysctl -p
The output shows that all the configurations have been successfully made.
Method 2: Using Kernel Module to Disable IPv6
Another way to disable IPv6 is to configure the GRUB and make the following changes as per the steps:
Step 1: Access and Configure the Network File
Open a terminal and navigate to the “/etc/default/grub” file for editing the network configuration file:
$ sudo nano /etc/default/grub
In the navigated file, assign the value “1” to the “ipv6.disable” parameter as below:
$ ipv6.disable=1
It disables IPv6 on the network interface after saving the changes and closing the editor.
Step 2: Reboot the System
Restart the network service using the “reboot” command to apply the changes and update the network configuration:
$ reboot
Step 3: Verify the Disable IPv6 Address
To verify the services of IPv6, the “ip addr show” command is utilized by specifying the “grep net6” command:
$ ip addr show | grep net6
Users can verify that the IPv6 has been disabled in the system.
Method 3: Using sysctl Command to Disable IPv6
Another way to disable IPv6 is possible by executing the “sysctl” command. For this, follow the below steps:
Step1: Disable IPv6
To disable IPv6 on a CentOS system, execute the “sysctl” command by assigning the value 1 to “disable_ipv6” variable:
$ sudo sysctl net.ipv6.conf.all.disable_ipv6 = 1
Step 2: Apply Changes
To apply the changes and configuration, the “sysctl” command is utilized with the “p” option that updates the kernel parameters:
$ sudo sysctl -p
The output shows that all the configurations have been successfully made.
Conclusion
CentOS / RHEL offers the “sysctl” configuration file and “kernel” module to disable IPv6 in the system.
Additionally, users can execute the “sudo sysctl net.ipv6.conf.all.disable_ipv6 = 1” script to disable the services of IPv6 on all network interfaces. This article has explained the methods for disabling IPv6 on CentOS / RHEL.