Why do you want to disable IPv6 on Linux systems?
There is some unfortunate situation, when enabling IPv6 slow down the network operations. The reason of problem comes from Bad or No IPv6 connectivity:
- Solution might be to ask your provider to support IPv6 properly
The other option would be to prefer IPv4 over IPv6, but the mechanisms (RFC 3484) to use this solution is just recently implemented in Linux system despite the RFC3484 implementation information available from Redhat. Implementation is available in Redhat Fedora Core 6 an later (and glibc 2006 september and later). The Fedore Core 6 had an implementation problem: The /etc/gai.conf read only in staring time of glibc. If not existed during startup it is not used, even it is created later. In the Fedora Core 7 (glibc version 2.5.90 release 21) you can create /etc/gai.conf any time and will be used to define policy.
- The last solution is the disable IPv6.
How can you disable IPv6 in Linux?
If the ipv6 module is loaded in in a Linux 2.6 based system, then the IPv6 support is enabled. That is good, but if you have got an ISP which does not offer IPv6 connectivity then you can reach sites which support both IPv4 and IPv6 only after a long timeout: your system tries to reach the other site over IPv6 and only after failing tries over IPv4 as well. By disabling IPv6 completely, you could get rid of the annoying timeout problem.
Unfortunately in spite of being a module, the ipv6 module cannot be removed from a running system: you must ensure it does not get loaded in at boot time.
In order to disable the ipv6 module, in /etc/modprobe.d/aliases change the line
alias net-pf-10 ipv6
to
alias net-pf-10 off alias ipv6 off
After doing so, reboot the system.
However in some systems it is not enough because sub-modules directly load in the ipv6 module. If that is your case then you can block to load in the module by adding the line
blacklist ipv6
to the file /etc/modprobe.d/blacklist. You have to reboot again and then IPv6 will be disabled in your system.