Linux: How To Disable The IPv6 Protocol

by Vivek Gite · 6 comments

Sometime you just need to disable IPv6 protocol. In some case, you do not need it at all or it may increase browsing speed and security.

Linux has Internet Protocol Version 6 (IPv6) enabled by default, almost all distros enable it.

RHEL v4 / CentOS v4

Open your modprob.conf file (Red Hat / CentOS / Fedora and friend) and add following line:
# vi /etc/modprobe.conf

Add following line:
alias net-pf-10 off
Save and close the file. Reboot the system.
See RedHat / Centos v5.x Disable IPv6 Networking for more info.

Debian / Ubuntu Linux

If you are using Debian/Ubuntu linux (thanks to beranger), open file /etc/modprobe.d/aliases
# vi /etc/modprobe.d/aliases
Find the line:
alias net-pf-10 ipv6

Replace with:
alias net-pf-10 off
alias ipv6 off

Save and close the file. Finally, reboot the system. IPv6 support should now be disabled and it did improve my DNS performance. Also you can install DNS proxy - to improve DNS performance and squid caching server.

See Also:

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 6 comments… read them below or add one }

1 Teodor 07.22.09 at 6:24 am

In Debian you should just blacklist the module like this:

HOSTu:~# vi /etc/modprobe.d/blacklist
[..]
## disable IPv6 module (to avoid DNS query delays)
blacklist ipv6

Sometimes this works on RHEL5 too, but not always (XEN virtualization).

Cheers

2 Axel 08.04.09 at 6:35 pm

in Debian Sid it’s /etc/modprobe.d/blacklist.conf
Regards, Axel

3 Pete 08.11.09 at 11:29 pm

In Fedora, you can edit /etc/sysconfig/network and add the following:
NETWORKING_IPV6=no
IPV6INIT=no

Pete.

4 Sean 11.28.09 at 9:45 pm

DISABLE IPV6 IN UBUNTU 9.10
gksu gedit /etc/default/grub

CHANGE THIS LINE:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

TO
GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

THEN UPDATE GRUB:
sudo update-grub

TO TEST WITH TERMINAL:
ip a | grep inet6

5 Harri 01.20.10 at 9:02 am

Even modifying /etc/modprobe.d/aliases.conf or blacklisting ipv6 might not be sufficient. Some packages load other kernel modules that depend upon ipv6, and then it is back.

There is only one reliable way: Build a kernel without ipv6 support.

6 the dsc 01.30.10 at 4:41 am

You do not need to reboot the system, “sudo /etc/init.d/networking restart” should suffice (or su if sudoers is not configured to permit that).

It may be interesting to have a tiny script or maybe two huge aliases to toggle ipv6, so whenever you stumble with something that requires it (debian multimedia repositories, for example), you may reactivate it.

I hope the whole ipv6-and-speed get solved soon, if too many people use such circumventions, then we’ll face some trouble when everything becomes ipv6.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: