How To Disable IPv6 On CentOS 7 / RHEL 7

Channel: Centos/Redhat
Abstract: sysctl.d Create file called disableipv6.conf in /etc/sysctl.d directory. vi /etc/sysctl.d/disableipv6.conf Put the following entry to disable IPv6 for
Disable IPv6 On CentOS 7

IPv6 has been around for many years, and organizations do not fully implement it since the IPv4 was enough for them.

This post helps you how to disable IPv6 on CentOS 7 / RHEL 7.

THIS DOCUMENT IS ALSO AVAILABLE FOR CentOS 8 CentOS 6 Debian 10 Debian 9 Ubuntu 18.04 Ubuntu 16.04 Disable IPv6 On CentOS 7 / RHEL 7

It can be disabled either by using sysctl.conf or by placing .conf in the /etc/sysctl.d directory. CentOS 7 now supports disabling IPv6 for all or a particular network adapter.

Method 1: sysctl.conf

Edit the /etc/sysctl.conf file.

vi /etc/sysctl.conf

Put the following entry to disable IPv6 for all adapter.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Put the following entry to disable IPv6 for a particular adapter (If the network card name is eno16777736).
net.ipv6.conf.eno16777736.disable_ipv6 = 1

To reflect the changes by executing the following command.

sysctl -p
Method 2: sysctl.d

Create file called disableipv6.conf in /etc/sysctl.d directory.

vi /etc/sysctl.d/disableipv6.conf

Put the following entry to disable IPv6 for all adapter

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Put the following entry to disable IPv6 for a particular adapter (If the network card name is eno16777736).
net.ipv6.conf.eno16777736.disable_ipv6 = 1

Restart the sysctl service to take an effect of the changes.

systemctl restart systemd-sysctl
Conclusion

That’s All. I hope you learned how to disable IPv6 on CentOS 7 / RHEL 7. Now, you can go ahead and configure static IPv4 address on your system.

Ref From: itzgeek

Related articles