linux2.4版以后的内核默认都能够支持ipv6,所以起动后我们会发现网卡上有两个版本的ip地址。在目前的网络环境中,由于ipv6还没有广泛开始应用,所以ipv6地址无法带来更好的优势,相反在进行地址解时会拖慢时间。因此我们可以通过关闭ipv6在一定程度上提高网络访问速度。
在Linux下首先确认IPv6是否已经被启用,可以从三个方面确定。
1.使用ifconfig查看自己的IP地址是否含有IPv6地址。
eth0 Link encap:Ethernet HWaddr 00:13:D4:05:B2:ED
inet addr:119.119.xxx.xx Bcast:119.119.115.255 Mask:255.255.255.0
inet6 addr: fe80::213:d4ff:fe05:b2ed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1054562 errors:0 dropped:0 overruns:0 frame:0
TX packets:538136 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:346189738 (330.1 MiB) TX bytes:246935731 (235.4 MiB)
Interrupt:209 Base address:0xd800

2.查看服务监听的IP中是否有IPv6格式的地址。(netstat -tuln)
tcp 0 0 0.0.0.0:8100 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:843 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 :::8080 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 :::443 :::* LISTEN

udp 0 0 0.0.0.0:68 0.0.0.0:*
udp 0 0 0.0.0.0:837 0.0.0.0:*
udp 0 0 0.0.0.0:840 0.0.0.0:*
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp 0 0 0.0.0.0:631 0.0.0.0:*

3.使用lsmod查看ipv6的模块是否被加载。
Module Size Used by
parport_pc 24577 1
lp 12077 0
parport 37129 2 parport_pc,lp
autofs4 24901 0
i2c_dev 11329 0
i2c_core 22081 1 i2c_dev
sunrpc 162597 1
loop 15817 2
dm_multipath 20681 0
button 6481 0
battery 8901 0
ac 4805 0
md5 4033 1
ipv6 234881 14
 
Here's the summary of what I can think of, with alternate methods in case the first one doesn't work with you:

Debian kernel 2.4:
  • In /etc/modutils, change the line
    alias net-pf-10 ipv6
    to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
Debian kernel 2.6/Ubuntu ("official" method)/Fedora Core (method 1):
  • In /etc/modprobe.d/aliases, change the line
    alias net-pf-10 ipv6
    to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
Debian kernel 2.6/Ubuntu (alternate method):
  • In /etc/modprobe.d/blacklist, add a line
    blacklist ipv6
  • Reboot.
RHEL/CentOS:
  • In /etc/modprobe.conf, make sure you have
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
RHEL/CentOS/Fedora Core (method 2)/Mandriva (method 1):
  • In /etc/sysconfig/network, add a line
    NETWORKING_IPV6="no"
  • Reboot.
SuSE 9.0:
  • In /etc/modules.conf, change the line
    alias net-pf-10 ipv6
    to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
SuSE 9.1/9.2/9.3/10.0 ("official" method):
  • In /etc/modprobe.conf, change the line
    alias net-pf-10 ipv6
    to
    alias net-pf-10 ipv6
    install ipv6 /bin/true
  • Reboot.
SuSE 9.1/9.2/9.3/10.0 (alternate method)/Mandriva (method 2)/Slackware:
  • In /etc/modprobe.conf, make sure you change
    alias net-pf-10 ipv6
    to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
Gentoo:
  • In /etc/modules.d/aliases, make sure you change
    alias net-pf-10 ipv6
    to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.

NOTES:
  • In distros using /etc/modprobe.conf, beware that you might get overriden by /etc/modprobe.conf.local or by /etc/modprobe.d/*.
  • If you disable IPv6, I suppose you don't need tunnels either. You could also add there:
    install sit0 /bin/true
  • A last "anti-IPv6" issue: don't forget the old trick of checking if your Firefox has IPv6 disabled:
    • CTRL+L, about:config (Enter)
    • Filter by ipv6.
    • Set network.dns.disableIPv6 to true.