A default install of CentOS will enable IPv6 connectivity. If you don’t need IPv6, there is no need to have it enabled. Follow the steps below to disable IPv6 on a CentOS install.
Note: Run these commands as a user with root privileges.
Check to see if you’re installation is currently set up for IPv6:
# cat /proc/sys/net/ipv6/conf/all/disable_ipv6
If the output is 0, IPv6 is enabled.
If the output is 1, IPv6 is already disabled.
Edit the /etc/sysctl.conf file to set the kernel parameter to disable IPv6:
# vi /etc/sysctl.conf
Scroll to the very bottom, and add the following line:
net.ipv6.conf.all.disable_ipv6 = 1
Save and exit the editor.
Reload the sysctl configuration:
# sysctl -p
or
# reboot
IPv6 should now be disabled.