跳到主要内容

4.1. 协议数据结构

IPv4 和 IPv6 的主要 OSPF data structure 相同: area, interface, neighbor, link-state database 和 routing table. IPv6 的 top-level data structure 仍然是 [OSPFV2] Section 5 中列出的结构, 但有以下修改:

  • 所有具有已知 LS type 和 AS flooding scope 的 LSA 都出现在 top-level data structure 中, 而不是属于某个特定 area 或 link. AS-external-LSA 是本规范定义的唯一具有 AS flooding scope 的 LSA. 具有未知 LS type, U-bit 设置为 1 (即使无法识别也 flood), 且具有 AS flooding scope 的 LSA 也出现在 top-level data structure 中.

4.1.1. Area Data Structure

IPv6 area data structure 包含 [OSPFV2] Section 6 中为 IPv4 area 定义的所有元素. 此外, 所有具有 area flooding scope 的已知类型 LSA 都包含在 IPv6 area data structure 中. 这始终包括以下 LSA 类型: router-LSA, network-LSA, inter-area-prefix-LSA, inter-area-router-LSA 和 intra-area-prefix-LSA. 具有未知 LS type, U-bit 设置为 1 (即使无法识别也 flood), 且具有 area scope 的 LSA 也出现在 area data structure 中. NSSA-LSA 也包含在 NSSA area 的 data structure 中.

4.1.2. Interface Data Structure

在 OSPF for IPv6 中, interface 将路由器连接到 link. IPv6 interface structure 对 [OSPFV2] Section 9 中定义的 IPv4 interface structure 作出如下修改:

Interface ID

每个 interface 都会分配一个 Interface ID, 它在路由器内唯一标识该 interface. 例如, 某些实现可能能够使用 MIB-II IfIndex ([INTFMIB]) 作为 Interface ID. Interface ID 会出现在从该 interface 发出的 Hello packet 中, 出现在路由器为所连接 link 发起的 link-local-LSA 中, 也出现在该路由器为关联 area 发起的 router-LSA 中. 如果该路由器被选为 Designated Router, Interface ID 还将作为该路由器为该 link 发起的 network-LSA 的 Link State ID.

virtual link 的 Interface ID 独立于它在 transit area 中穿越的 outgoing interface 的 Interface ID.

Instance ID

每个 interface 都会分配一个 Instance ID. 它应默认为 0. 只有在包含多个相互独立 OSPF router community 的 link 上, 才需要分配非 0 值. 例如, 假设某个 ethernet segment 上有两个你希望保持分离的 router community.

第一个 community 分配 Instance ID 0, 并且第一个 community 中所有路由器连接到该 ethernet segment 的 interface 都会分配 0 作为 Instance ID. 其他路由器连接到该 ethernet segment 的 interface 分配 Instance ID 1. 然后, OSPF 发送和接收处理 (见 Section 4.2) 会将这两个 community 保持分离.

List of LSAs with link-local scope

所有具有 link-local scope 且在该 link 上发起或 flood 的 LSA 都属于连接到该 link 的 interface structure. 这包括该 link 的 link-LSA 集合.

IP interface address

对于 IPv6, 在该 interface 上发送的 OSPF packet 的 source 中出现的 IPv6 address 几乎总是 link-local address. 唯一的例外是 virtual link, 它必须使用路由器自身的某个 global IPv6 address 作为 IP interface address.

List of link prefixes

可以为所连接的 link 配置 IPv6 prefix 列表. 路由器会在 link-LSA 中通告这些 prefix, 以便该 link 的 Designated Router 可以在 intra-area-prefix-LSA 中通告它们.

在 OSPF for IPv6 中, 每个 router interface 都有一个单一 metric, 表示在该 interface 上发送 packet 的 cost. 此外, 如 [OSPFV3-AUTH] 所述, OSPF for IPv6 依赖 IP Authentication Header (见 [IPAUTH]) 和 IP Encapsulating Security Payload (见 [IPESP]) 来确保 routing exchange 的完整性以及认证/机密性. 因此, AuType 和 Authentication key 不与 IPv6 OSPF interface 关联.

interface state, event 和 interface state machine 分别与 [OSPFV2] Sections 9.1, 9.2 和 9.3 中记录的 IPv4 内容保持不变. Designated Router 和 Backup Designated Router 选举算法也与 [OSPFV2] Section 9.4 中的 IPv4 选举保持不变.

4.1.3. Neighbor Data Structure

neighbor structure 在 IPv6 和 IPv4 中执行相同功能. 也就是说, 当两个路由器之间需要形成 adjacency 时, 它收集形成该 adjacency 所需的全部信息. 每个 neighbor structure 都绑定到单个 OSPF interface. IPv6 neighbor structure 与 [OSPFV2] Section 10 中为 IPv4 定义的 neighbor structure 的差异如下:

Neighbor's Interface ID

必须在 neighbor structure 中记录邻居在其 Hello packet 中通告的 Interface ID. 当 a) 向该邻居通告 point-to-point 或 point-to-multipoint link, 或 b) 通告指向某个 network 的 link 且该邻居已成为 Designated Router 时, 路由器会在自身的 router-LSA 中包含该邻居的 Interface ID.

Neighbor IP address

邻居的 IPv6 address, 即 OSPF for IPv6 packet 中作为 source address 包含的地址. 对于除 virtual link 之外的所有 link 类型, 这将是 IPv6 link-local address.

Neighbor's Designated Router

邻居选择的 Designated Router 现在编码为 Router ID, 而不是 IP address.

Neighbor's Backup Designated Router

邻居选择的 Backup Designated Router 现在编码为 Router ID, 而不是 IP address.

neighbor state, event 和 neighbor state machine 分别与 [OSPFV2] Sections 10.1, 10.2 和 10.3 中记录的 IPv4 内容保持不变. 关于形成哪些 adjacency 的决策也与 [OSPFV2] Section 10.4 中记录的 IPv4 逻辑保持不变.