How to Disable IPv6 on RHEL/CentOS 8

disable ipv6 on rhel and centos 8

IPv6 (Internet Protocol Version 6) is an internet protocol that routes traffic and provides an identification and location system for computers on networks. It has long been touted that IPv6 will replace IPv4, but we are not there yet. Disabling IPv6 on your system is actually quite straightforward.

In this guide, you will learn how to disable IPv6 on RHEL/CentOS 8.

Read Also: How to Disable IPv6 in RHEL/CentOS 7/Fedora

Check if IPv6 is enabled

First, check if IPv6 is currently enabled on our system. To do so, we are going to run the command:

$ ip a | grep inet6

From the output below, you can see IPv6 entries, implying that IPv6 is enabled.

Verify if IPv6 is enabled
Verify if IPv6 is enabled

The next step is to disable IPv6. There are two ways of going about this:

1)  Disable IPv6 on CentOS 8 using the kernel boot option

If you want to permanently disable IPv6 on your system, then this is the method to opt for. Also, note that this requires a reboot for the changes to come into effect.

The first step is to open the default GRUB configuration file as shown:

$ sudo vim /etc/default/grub

At the end of the file, append the following line:


disable IPv6 on CentOS 8 using kernel options
Disable IPv6 on CentOS 8 using kernel options

Save the file and exit.

For the changes to take effect, we need to update the GRUB configuration files. But first, we need to know where the GRUB configuration files are located. To achieve this, run the command:

$ sudo ls -lh /etc/grub*.cfg
find the location of grub configuration files
find the location of grub configuration files

Next, generate a new GRUB configuration file to save it to the /boot/grub2/grub.cfg file.

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Update grub configuration file
Update grub configuration file

Additionally, run the next command to create a new configuration file and save it to /boot/efi/EFI/centos/grub2.cfg file

$ sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub2.cfg
Generate a new grub configuration file
Generate a new grub configuration file

Thereafter, reboot your system using the command:

$ sudo reboot

Once the reboot is complete, log in and once again, run the command below. Notice that IPv6 information is not listed.

$ ip  a | grep inet6
IPv6 disabled on CentOS 8
IPv6 already disabled

2)  Disable IPv6 using sysctl

So far, we have looked at one method of disabling IPv6  on CentOS 8. The next method is using sysctl which is a software utility used to modify kernel parameters at runtime. This is a  temporary fix and does not require a system reboot.

First, create a new configuration file as shown:

$ sudo vim /etc/sysctl.d/70-ipv6.conf

Then add the lines shown

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Add entries to the new sysctl file

Save and exit the configuration file. Before we disable the IPv6 protocol, let us first do a check to see what the value of the command net.ipv6.conf.default.disable_ipv6  is. You should get the value of 0.

$ sudo sysctl --values net.ipv6.conf.default.disable_ipv6
systcl value of 0
systcl value of 0 when checking IPv6

To disable IPv6, execute the command:

$ sysctl --load /etc/sysctl.d/70-ipv6.conf
Disable IPv6 using sysctl
Disable IPv6 using sysctl

Now, verify the sysctl value once more and this time, you will get the value of 1 indicating that Ipv6 has been disabled.

$ sudo sysctl --values net.ipv6.conf.default.disable_ipv6
systcl value of 1
systcl value of 1


While IPv6 is intended to replace IPv4, a majority of the systems are still using IPV4. In fact, according to Google,  IPv6 has an adoption rate of only 20% and it will take quite sometime before the world runs out of IPv4 addresses. If you wish to disable IPv6 on CentOS 8, we hope this guide provided useful insights on how to go about it.

Leave a Comment