Linux diable ipv6

來源:互聯網
上載者:User

標籤:

在RHEL 5下面測試成功  linux下面禁止ipv6的方法:來自: 楊志剛 部落格 (http://yangzhigang.cublog.cn) 這裡我所做的是Redhat Linux,在系統中ifconfig或是netstat -an都會顯示出IPV6的結果,如:[[email protected] 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 [[email protected] 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 linealias net-pf-10 ipv6toalias 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 linealias net-pf-10 ipv6to
    alias net-pf-10 off
    alias ipv6 off
  • Reboot.
• Debian kernel 2.6/Ubuntu (alternate method):
  • In /etc/modprobe.d/blacklist, add a lineblacklist ipv6
  • Reboot.
• RHEL/CentOS:
  • In /etc/modprobe.conf, make sure you havealias net-pf-10 off
    alias ipv6 off
  • Reboot.
• RHEL/CentOS/Fedora Core (method 2)/Mandriva (method 1):
  • In /etc/sysconfig/network, add a lineNETWORKING_IPV6="no"
  • Reboot.
• SuSE 9.0:
  • In /etc/modules.conf, change the linealias net-pf-10 ipv6toalias 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 linealias net-pf-10 ipv6toalias 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 changealias net-pf-10 ipv6toalias net-pf-10 off
    alias ipv6 off
  • Reboot.
• Gentoo:
  • In /etc/modules.d/aliases, make sure you changealias net-pf-10 ipv6toalias 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

Linux diable ipv6

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.