ipv6设置 "eth0: duplicate address detected!" 检测到重复地址问题


今天用SSH连接Linux server, 总是连接不上,在server上操作之后,发现可以获得ip地址,而且能够ping通另外的server。查看系统log文件,/var/log/syslog 或者 /var/log/message 都可以看到如下的类似错误信息:

kernel: [ 1251.856114] eth2: IPv6 duplicate address detected!

看来是IPV6的地址冲突,先尝试了在gnome-control-center中对网络设置,禁止IPV6,但是没有效果。在网上搜索,也没有找到方法,最后自己解决了,方法如下:

==================================================================

1、参考该网站:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/482181

注意到这两句:

My current workaround to disbale DAD by doing the following:
root# echo '0' > /proc/sys/net/ipv6/conf/eth0/accept_dad

我自己的server上有两个网卡,用的是eth2,所以我机械的使用命令echo '2' > /proc/sys/net/ipv6/conf/eth2/accept_dad,然后使用命令:

ifconfig eth2 down

ifconfig eth2 up

问题没有解决。仔细分析后知道吗,echo '0' 中的0 是参数accept_dad的值,应该改为: echo '0' > /proc/sys/net/ipv6/conf/eth2/accept_dad,再搜索后知道 这是禁止IPV6的地址冲突检测。

但是问题仍然没有解决。


2、参考网站:http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/IPv6-in-Linux/

这篇文章非常详细的讲解了很多问题,特别注意:

DAD stands for Duplicate Address Detection. It uses Neighbour Solicitation and Neighbour Advertisement messages. If DAD does not find the same IPv6 address on the LAN, the state of the address is set to be permanent, and from now on it starts to communicate with all types of packets, not just Neighboring messages as before.

In case DAD does find a duplicate address, the address we tried to set is deleted (and in the syslog you see a message like this: "eth0: duplicate address detected!"). In such a case, a sysadmin needs to configure an address manually.

再分析/proc/sys/net/ipv6/conf/eth2下的文件,发现有一个:disable_ipv6的文件。突然醒悟,使用命令:echo '1' > /proc/sys/net/ipv6/conf/eth2/disable_ipv6,设置参数,禁止IPV6后,问题解决,使用ifconfig,ipv6的地址没有了。但之前使用gnome-control-center设置后,使用该命令,仍然可以查看到ipv6地址。

 转载自:http://hi.baidu.com/remygo/item/6456271cd80e4f5ff0090e5c

原文地址:https://www.cnblogs.com/catkins/p/5270650.html