Advance

How to Disable IPv6 in CentOS 8

How to Disable IPv6 in CentOS 8
1
(1)

In the following of CentOS 8 tutorials, in this article, we will learn How to Disable IPv6 in CentOS. 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.

 

How to Disable IPv6 in CentOS 8

Let’s walk through the steps of this tutorial to show you a few ways to disable IPv6 in your CentOS 8 Linux machine.

 

Disabling IPv6 in CentOS 8

To check whether IPv6 is enabled on your CentOS 8 machine or not, type:

ip a | grep inet6

You see some inet6 lines if IPv6 enabled. So if the command doesn’t print anything, IPv6 is disabled on all your network interfaces.

Recommended Article: How to Linux login without entering password

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.

First create a new sysctl configuration file /etc/sysctl.d/70-ipv6.conf.

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

Then, add the following lines and save the file.

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

And, use the command below to disable IPv6.

sysctl --load /etc/sysctl.d/70-ipv6.conf  

After that, IPv6 should be disabled.

Next, run the following command to verify if IPv6 is disabled.

ip a | grep inet6  

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

some of your network interfaces may still use IPv6 once you reboot your system, while you are using this method. When CentOS 8 uses Network Manager, this would happen.

Type the command below to completely stop using IPv6.

nmcli connection modify interface ipv6.method ignore  

Finally, reboot your CentOS 8 machine.

reboot

Buy VPS Server

Disable IPv6 Using The Kernel Boot Option

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

You can open the default GRUB configuration file /etc/default/grub with the vi text editor to use this method.

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"  

You can save and exit the configuration file.

Type the following command to locate the grub files and update the GRUB CFG files.

ls -lh /etc/grub*.cfg  

In the following, you will see 2 GRUB CFG file paths: /boot/grub2/grub.cfg and /boot/efi/EFI/centos/grub.cfg.

Use 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  

Again, 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, use the following command to verify whether IPv6 is disabled.

ip a | grep inet6

In case, you would not face any print of this command, it means IPv6 is disabled.

 

Good job! Reaching this point means that you have finished the tutorial. So you learned about two ways you can disable IPv6 on your CentOS 8 Linux machine. As you remember, 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.

 

Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problems in it.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day