Short tip: Disable IPv6 completely under RHEL / CentOS

Use the following commands to completely disable IPv6 under RHEL / CentOS up to version 6:

1# echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf
2# chkconfig ip6tables off
3# shutdown -r now

A module parameter prohibits IPv6 functionality after the next reboot. If this value wasn't set, some services still open IPv6 sockets. The IPv6 firewall isn't required anymore - disable it.

Beginnign with Enterprise Linux 7, this behaviour has changed requiring a kernel variable to be set:

1# echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.d/99-ipv6.conf
2# echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.d/99-ipv6.conf
3# sysctl -w net.ipv6.conf.all.disable_ipv6=1
4# sysctl -w net.ipv6.conf.default.disable_ipv6=1
5# systemctl disable ip6tables ; systemctl stop ip6table

Translations: