How To Disable IPv6 On CentOS 8 / RHEL 8

Most of the organizations still use IPv4 for network communications and not in need of IPv6. In these cases, your system doesn’t need to support IPv6.

This post helps you to disable IPv6 on CentOS 8 / RHEL 8.
Disable IPv6 On CentOS 8 / RHEL 8
IPv6 can be disabled either by using sysctl.conf or by placing .conf file in the /etc/sysctl.d directory. CentOS 8 supports the disabling of IPv6 for all interfaces or specific to a particular network interface.
Method 1: systctl.d
Create a file called disableipv6.conf in /etc/sysctl.d directory.
vi /etc/sysctl.d/disableipv6.conf
Place the following entry to disable IPv6 for all adapter
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 1
Run the following command to reflect the changes.
systemctl restart systemd-sysctl
Method 2: sysctl.conf
Edit the /etc/sysctl.conf file.
vi /etc/sysctl.conf
Place the following entry to disable IPv6 for all adapter.
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 1
Run the following command to reflect the changes.
sysctl -p
Verify
Use the ifconfig command to see the network interfaces. You should see IPv6 address is no longer set on interfaces.

Conclusion
That’s All. I hope you learned how to disable IPv6 on CentOS 8 / RHEL 8. You can now proceed to configure IP Address on your CentOS 8 / RHEL 8 systems.