By default, IPv6 has been set to enabled on linux CentOS 5.8 minimum installation. If you plan to disable this feature, you can follow these steps to completely disable it. This can avoid accidentally loaded IPv6 module. This steps may working on other CentOS version.
1. Create disable-ipv6.conf on /etc/modprobe.d/ and add the following line :
[[email protected] ~]# vi /etc/modprobe.d/disable-ipv6.conf
Add the following line :
install ipv6 /bin/true
Whenever the system needs to load the ipv6 kernel module, it is forced to execute the command true instead of actually loading the module.
2. Edit /etc/sysconfig/network and modify as below :
Set NETWORKING_IPV6 value to “no” :NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain
3. Do not forget to disable and stop the IPv6 firewall if exist :
Disable auto start at boot :[[email protected] ~]# /sbin/chkconfig ip6tables off
Stop ip6tables service if running :[[email protected] ~]# service ip6tables stop
4. Add “net.ipv6.conf.all.disable_ipv6 = 1” into /etc/sysctl.conf[[email protected] ~]# echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
or[[email protected] ~]# vi /etc/sysctl.conf
Add the following line at the bottom of sysctl.conf file :.. ... net.ipv4.tcp_syncookies = 1 ...
5. Reboot the server is required to complete the steps above.