Linux diable ipv6

在RHEL 5下面测试成功
 
 
linux下面禁止ipv6的方法:
来自: 杨志刚 博客 (http://yangzhigang.cublog.cn)
 
这里我所做的是Redhat Linux,在系统中ifconfig或是netstat -an都会显示出IPV6的结果,如:
[root@WebServer-22 conf]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:15:C5:EF:74:1C 
          inet addr:192.168.102.22  Bcast:192.168.102.255  Mask:255.255.255.0
          inet6 addr: fe80::215:c5ff:feef:741c/64 Scope:Link
 
[root@WebServer-22 conf]# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address            
tcp 0 576 ::ffff:192.168.102.22:22    ::ffff:192.168.12.100:3339  ESTABLISHED
tcp 0 0   ::ffff:192.168.102.22:80    ::ffff:192.168.102.25:36479 TIME_WAIT  
tcp 0 0   ::ffff:192.168.102.22:80    ::ffff:192.168.102.25:36503 TIME_WAIT  
 
在IPV6还没有广泛使用时,这有些不方便,那么在Redhat Linux下禁止IPV6的方法也很容易:
vi /etc/modprobe.conf,加入以下两行参数,
alias net-pf-10 off
alias ipv6 off
之后reboot。(注:用service network restart是不可以的)
 
重启之后,ifconfig或netstat -ant等只能显示IPV4的地址信息了。
 
对于其他的系统,可以参照以下文档:
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.

 

 

 

摘于:http://blog.chinaunix.net/uid-7654720-id-1742032.html

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。