个人工具

UbuntuHelp:WebBrowsingSlowIPv6IPv4/zh

来自Ubuntu中文

Dgww讨论 | 贡献2008年7月8日 (二) 14:55的版本 (新页面: == Disabling IPv6 == Ubuntu: <ol><li>Open a terminal and type: <pre><nowiki> gksudo gedit /etc/modprobe.d/blacklist </nowiki></pre> </li><li>Add this line: <pre><nowiki> blacklist ipv6 </...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

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>