您的位置:首页 > 其它

理解IPv6中的重复地址检测(DAD)

2009-02-12 14:56 567 查看
1. 简介
地址重复检测(DAD: Duplicate Address Detection)背景要求:
. 节点在发送路由器公告(RA)之前要获得唯一的本地链路地址。
. IPv6自动配置要求在使用地址之前进行地址重复检测(DAD)。
. 标准DAD花费较长时间才能完成,因而引入了“乐观的DAD”(RFC 4429)。

2. 标准DAD过程
(1) 在发送邻居请求(NS)前,接口必须加入全节点组播地址(FF02::1)和生成IPv6地址的请求节点组播地址(solicited-node multicast address),即接收目的地址为这些IPv6地址的分组。

(2)生成IPv6地址后随机延时一段时间后开始发送用于DAD的邻居请求(NS)消息。
邻居请求(NS)消息的源地址为::,目的地址为临时单播地址的请求节点组播地址

(3) 在DAD过程中地址处于Tentative状态(“暂时的”)(IFA_F_TENTATIVE)。在完成DAD过程后,tenativeAddr将会被作为“首选的”地址(PreferedAddr)。若发现了重复地址,则该地址变为"废弃的"地址(deprecatedAddr)。

背后原理:未确定唯一性的地址不能使用
即不能接收目的地址或者发送源地址为此地址的分组,但是与DAD相关的邻居公告(NA)消息除外。

(4) 以下参数值是Linux操作系统下的缺省值,这些参数可根据需要配置:
. 发送邻居请求(NS)的个数n=1
. 发送间隔Tret=1000ms

3. 地址冲突处理:
(1) 当节点收到目的地址为其正在做DAD检测地址的邻居请求(NS)消息时:
. 如果请求的源地址类型为IPV6_ADDR_ANY(全0地址::),则节点从接口上删除这个地址(DAD检测失败)
. 否则节点不处理此NS消息

(2) 当节点收到目的地址为其正在做DAD检测地址的邻居公告(NA)时,则节点从接口上删除这个地址(DAD检测失败)

(3) 如果节点为某个IPv6地址完成DAD检测后,收到来自其它节点发送的目的地址为此IPv6地址的用作DAD检测的邻居请求(NS)消息(此时该请求的源地址为IPV6_ADDR_ANY),则节点应该向全节点地址(ff02::1)发送邻居公告(NA)。

4. 乐观的DAD(ODAD: Optimistic DAD)
可参见: RFC 4429 - Optimistic Duplicate Address Detection (DAD) for IPv6

(2) 生成IPv6地址后立即发送用于DAD的邻居请求(NS)消息

(3) 在DAD过程中引入Optimistic状态地址
ODAD允许在完成对optimisticAddr的DAD之前使用该地址,

背后原理:未确定唯一性之前地址可以先使用
即能接收目的地址或者发送源地址为此地址的分组。

optimisticAddr在完成DAD之前为Optimistic状态(IFA_F_OPTIMISTIC)。在完成DAD过程后,optimisticAddr将会被作为“首选的”地址(PreferedAddr)。若发现了重复地址,则该地址变为"废弃的"地址(deprecatedAddr)。

DAD是移动IPv6(MIPv6)切换时延中所需时间最长的一个阶段,RFC 4429中提出的ODAD可以使得在DAD完成之前 节点 可以利用“暂时的”地址进行通信,从而避免了MIPv6切换过程中等待DAD完成后节点才能使用所得到的地址进行通信所造成的延时,因而MIPv6的切换时延将会大大减小。

发送的与Optimisitc地址相关的任何消息不能覆盖已有的邻居缓存(NC:Neighbour Cache),因而需要对原有协议RFC 2461/2进行修改,以避免在出现地址碰撞的情况下网络不会中断:
* 清除针对Optimistic地址的邻居公告(NA)消息中的‘Override’标志,
以避免邻居在接收到该NA消息后覆盖其已有的NC表项。

* 不发送源地址为Optimistic地址的邻居请求(NS)消息。
NS消息中要包含一个发送者链路地址选项(SLLAO: Source Link-Layer Address Option)选项, 这可能会破坏邻居节点的NC.
DAD过程中发送的NS消息源地址为未指定地址, 不携带SLLAO选项.

* 如果发送源地址为Optimistic地址的路由器请求(RS)消息,则不能带有SLLAO选项。
发送的RS消息中可以使用源地址为未指定地址或者不带有SLLAO选项。

5. RFC 4429中的一些细节要求:
3.1. General
* Optimistic DAD SHOULD .ly be used when the implementation is aware
that the address is based . a most likely unique interface
identifier (such as in [RFC2464]), generated randomly [RFC3041],
or by a well-distributed hash function [RFC3972] or assigned by
Dynamic Host Configuration Protocol for IPv6 (DHCPv6) [RFC3315].
Optimistic DAD 不应当(SHOULD NOT)用于手工配置的地址(即不应当设置IFA_F_OPTIMISTIC标志).

3.2. Modifications to RFC 2461 Neighbor Discovery

* (modifies section 6.3.7) A node MUST NOT send a Router
Solicitation with a SLLAO from an Optimistic Address. Router
Solicitations SHOULD be sent from a non-Optimistic or the
Unspecified Address;
节点可以(MAY)从Optimistic Address发送不包含SLLAO的RS消息.

* (modifies section 7.2.2) A node MUST NOT use an Optimistic Address
as the source address of a Neighbor Solicitation.

* If the . isn't told the SLLAO of the router in an RA, and it
cannot determine this information without breaching the rules
above, it MUST leave the address Tentative until DAD completes
despite being unable to send any packets to the router.

* (modifies section 7.2.2) When a node has a unicast packet to send
from an Optimistic Address to a neighbor, but does not know the
neighbor's link-layer address, it MUST NOT perform Address
Resolution. It SHOULD forward the packet to a default router .
the link in the hope that the packet will be redirected.
Otherwise, it SHOULD buffer the packet until DAD is complete.

3.3 Modifications to RFC 2462 Stateless Address Autoconfiguration

* (modifies section 5.5) A host MAY choose to configure a new address
as an Optimistic Address. A host that does not know the SLLAO
of its router SHOULD NOT configure a new address as Optimistic.
A router SHOULD NOT configure an Optimistic Address.

* (modifies section 5.4.2) The host MUST join the all-nodes multicast
address and the solicited-node multicast address of the
Tentative address. The host SHOULD NOT delay before sending
Neighbor Solicitation messages.

* (modifies section 5.4) The Optimistic Address is configured and
available for use . the interface immediately. The address
MUST be flagged as 'Optimistic'.

* When DAD completes for an Optimistic Address, the address is no
longer Optimistic and it becomes Preferred or Deprecated
according to the rules of RFC 2462.

* (modifies section 5.4.3) The node MUST NOT reply to a Neighbor
Solicitation for an Optimistic Address from the unspecified
address. Receipt of such an NS indicates that the address is a
duplicate, and it MUST be deconfigured as per the .
specified in RFC 2462 for Tentative addresses.

* (modifies section 5.4.3) The node MUST reply to a Neighbor
Solicitation for an Optimistic Address from a unicast address,
but the reply MUST have the Override flag cleared (O=0).

实现: Linux中配置选项CONFIG_IPV6_OPTIMISTIC_DAD

[1] N. Moore, "Optimistic Duplicate Address Detection (DAD) for IPv6", RFC 4429, April 2006.
[2] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection, http://lwn.net/Articles/218597/
本文出自 “kapu” 博客,请务必保留此出处http://kapok.blog.51cto.com/517862/130464
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: