How to disable IPv6 on CentOS and Ubuntu

Mostly you just need to disable IPv6 protocol. But in some case, you do not need it at all or it may increase browsing speed. Linux has Internet Protocol Version 6 (IPv6) enabled. By default, almost all distros enable it.

Red Hat and similar ones (like Fedora and CentOS)

Open your modprob.conf file and add following lines:

# vi /etc/modprobe.conf

Add following line in the bottom:

alias ipv6 off

alias net-pf-10 off

The run chkconfig ip6tables off to disable IPv6 firewalls.  After that reboot your system.

An alternative way (which might be easier and works on any release with /etc/modprobe.d):

echo “install ipv6 /bin/true” > /etc/modprobe.d/disable-ipv6

With CentOS 5.4 update symbol/ipv6 module dependency capabilities have been introduced; therefore, if IPv6 has been previously disabled as above an upgrade to the bonding driver in 5.4 will result in the bonding kernel module failing to load. For the module to load properly use instead:

echo “options ipv6 disable=1” > /etc/modprobe.d/disable-ipv6

Debian and similar ones ( like Ubuntu)

If you are running Debian based Linux (like Ubuntu), open file /etc/modprobe.d/aliases
# vi /etc/modprobe.d/aliases
Find the line:
alias net-pf-10 ipv6
Replace to:
alias net-pf-10 off
alias ipv6 off

There is also an alternative method in Debian kernel 2.6:
open “/etc/modprobe.d/blacklist“, add a line

blacklist ipv6

followed by a reboot will be OK.

OpenSuSE /SuSE Enterprise Linux (SuSE 9.1/9.2/9.3/10.0, etc)

the official method to disable IPv6:

open “/etc/modprobe.conf“, change the line:

alias net-pf-10 ipv6


alias net-pf-10 ipv6
install ipv6 /bin/true

then, reboot …

An alternative method is also available in SuSE 9.1/9.2/9.3/10.0, Mandriva/Slackware:
Open “/etc/modprobe.conf”, make sure you change

alias net-pf-10 ipv6


alias net-pf-10 off
alias ipv6 off

then, save and reboot the system. IPv6 support will now be disabled and it did improve the DNS performance.

Share this post

One thought on “How to disable IPv6 on CentOS and Ubuntu

Post Comment