How to Disable IPv6 in CentOS 8

An internet protocol version 6 (IPv6) is an identifier of a network interface that’s involved in an IPv6 computer network. If you don’t want to use Ipv6 addressing, you can opt to disable it either temporarily or permanently.

In this article, you are going to learn a few ways to disable IPv6 in your CentOS 8 Linux machine.

Disabling IPv6 in CentOS 8

First, check whether IPv6 is enabled on your CentOS 8 machine using the following ip command.

# ip a | grep inet6
Check IPv6 Status in CentOS 8

Check IPv6 Status in CentOS 8

If IPv6 enabled, you can see some inet6 lines, however, if the command doesn’t print anything, IPv6 is disabled on all your network interfaces.

Disable IPv6 Using sysctl Command

This method is for temporary disabling IPv6. You don’t require to reboot your system for the changes to take place. However, it’s quite complicated than the permanent method you will learn shortly.

First create a new sysctl configuration file /etc/sysctl.d/70-ipv6.conf using the following command.

# vi /etc/sysctl.d/70-ipv6.conf

Next, add the following lines and save the file.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Sysctl Configuration File

Sysctl Configuration File

Now, to disable IPv6 use the following command.

# sysctl --load /etc/sysctl.d/70-ipv6.conf
Temporarily Disable IPv6 in CentOS 8

Temporarily Disable IPv6 in CentOS 8

IPv6 should now be disabled.

To verify if IPv6 is disabled, run the following ip command.

# ip a | grep inet6
Check IPv6 Disabled in CentOS 8

Check IPv6 Disabled in CentOS 8

If the command doesn’t return anything implying that IPv6 has been disabled on all your network interfaces.

When using this method, some of your network interfaces may still use IPv6 once you reboot your system. This happens because CentOS 8 uses Network Manager by default.

To completely stop using IPv6, use the following nmcli command.

# nmcli connection modify interface ipv6.method ignore

Finally, reboot your CentOS 8 machine.

# reboot

Disable IPv6 Using The Kernel Boot Option

The kernel boot option requires a system reboot after the configuration. It’s the best method of disabling IPv6.

To use this method, open the default GRUB configuration file /etc/default/grub with the vi text editor, as shown below.

# vi /etc/default/grub

Next, head to the end of the file and press O to create a new line and type the following.

GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX ipv6.disable=1"

Next, save and exit the configuration file.

The next step is to update the GRUB CFG files. Type the following command to locate the grub files.

#  ls -lh /etc/grub*.cfg

You will see 2 GRUB CFG file paths: /boot/grub2/grub.cfg and /boot/efi/EFI/centos/grub.cfg.

Type the following command to create a new GRUB configuration file and save it to /boot/grub2/grub.cfg.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Next, type the following command to create a new GRUB configuration file and save it to /boot/efi/EFI/centos/grub.cfg.

# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Finally, reboot your CentOS 8 machine.

# reboot

After rebooting, type the following command to verify whether IPv6 is disabled.

# ip a | grep inet6

If the command does not print anything, it means IPv6 is disabled.

Summary

In this article, you have learned about two ways you can disable IPv6 on your CentOS 8 Linux machine. The first method is by using sysctl while the second is by using the Kernel boot option. While Disabling IPv6 Using sysctl is temporary, the Kernel boot option is permanent and is the best method.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.