个人工具

UbuntuHelp:WebBrowsingSlowIPv6IPv4

来自Ubuntu中文

Wikibot讨论 | 贡献2008年4月23日 (三) 12:03的版本

跳转至: 导航, 搜索


Ubuntu has a newer Internet protocol called IPv6 turned on by default. However, some hardware — such as NICs and modems — shows broken behavior when exposed to IPv6 related DNS requests. This leaves you wondering why DNS resolution seems slower or doesn't work at all. This guide shows how to disable this new protocol.

Disabling IPv6

Ubuntu:

  1. Open a terminal and type:
    gksudo gedit /etc/modprobe.d/blacklist
    
  2. Add this line:
    blacklist ipv6
    
  3. Save the file and restart your computer

Kubuntu:

  1. Open a terminal and type:
    kdesu kate /etc/modprobe.d/blacklist
    
  2. Add this line:
    blacklist ipv6
    
  3. Save the file and restart your computer
After restarting, open up a terminal and type:
ip a | grep inet6

If there's no output, IPv6 is disabled. Another method (perhaps simpler) is editing /etc/modprobe.d/aliases and replacing "alias net-pf-10 ipv6" with "alias net-pf-10 off". Done!

Alternative method for Gutsy

On a cleanly installed Gutsy server the above methods didn't work (that is, ip a | grep inet6 kept generating output showing that IPv6 was not actually disabled). According to Planète Béranger (Radu-Cristian Fotescu), the best method to prevent a module from loading at boot time is adding the following to some of the files in /etc/modprobe.d (you can do it within /etc/modprobe.d/blacklist):

install ipv6 /bin/true

Another variant method that works for Gutsy, is to add in /etc/modprobe.d/arch/i386:

# no ipv6
alias net-pf-10 off

(In my case having ipv6 enabled breaks Netfilter's SNAT.)

Disabling IPv6 temporarily

If you just want to disable IPv6 temporary, you will discover that you can't just unload the ipv6 kernel module as long as an ipv6 address is configured for your device. You can use ifconfig to see which addresses are currently configured for your devices and disabling them with the following command:
sudo ifconfig <interface> inet6 del <ipv6address>/<prefixlength>

Identifying the Broken Device

The real reason for the problem is because IPv6 does DNS queries for "AAAA" records which request the IPv6 address of an internet hostname. You can identify the problem from a terminal, by making a specific DNS query such as:

dig AAAA www.kame.net

The corresponding query for an IPv4 address would be:

dig A www.kame.net

If the first one of these queries times out without returning a valid IPv6 address then your internet router is not working correctly and you may want to see if there is a firmware upgrade available to fix the real problem.