Follow these steps to disable IPv6 on CentOS. Edit the /etc/sysctl.conf file, I will use the nano editor here:
nano /etc/sysctl.conf
And add the following line at the end of the file:
net.ipv6.conf.all.disable_ipv6 = 1
Then run:
sysctl -p
to load the new settings.
The next step is to edit the network card configuration file (/etc/sysconfig/network-scripts/ifcfg-eth*) and add or edit the setting IPV6INIT so that it is set to "no".
IPV6INIT="no"
Now edit the file /etc/sysconfig/network:
nano /etc/sysconfig/network
And set the NETWORKING_IPV6 option to "no":
NETWORKING_IPV6=no
Then restart the server.
You can also add “ipv6.disable=1″ to grub (/etc/default/grub) so it looks like GRUB_CMDLINE_LINUX=”existing_stuff ipv6.disable=1” and reboot your server.