在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
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
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,加入以下两行参数,
vi /etc/modprobe.conf,加入以下两行参数,
alias net-pf-10 off
alias ipv6 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:
|
• Debian kernel 2.6/Ubuntu ("official" method)/Fedora Core (method 1):
|
• Debian kernel 2.6/Ubuntu (alternate method):
|
• RHEL/CentOS:
|
• RHEL/CentOS/Fedora Core (method 2)/Mandriva (method 1):
|
• SuSE 9.0:
|
• SuSE 9.1/9.2/9.3/10.0 ("official" method):
|
• SuSE 9.1/9.2/9.3/10.0 (alternate method)/Mandriva (method 2)/Slackware:
|
• Gentoo:
|
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