跳到主要内容

9. UPDATE Message 处理

9. UPDATE Message 处理 (UPDATE Message Handling)

UPDATE message 只能在 Established state 中接收. 在任何其他 state 中收到 UPDATE message 都是 error. 收到 UPDATE message 时, 每个 field 都会按 Section 6.3 中的规定检查 validity.

如果 optional non-transitive attribute 无法识别, 则静默忽略. 如果 optional transitive attribute 无法识别, 则 Attribute Flags octet 中的 Partial bit (第三个最高位 bit) 设置为 1, 并保留该 attribute 以便传播给其他 BGP speaker.

如果 optional attribute 可识别且具有 valid value, 则根据 optional attribute 的 type 对其进行本地处理, 保留, 并在必要时更新, 以便可能传播给其他 BGP speaker.

如果 UPDATE message 包含非空 WITHDRAWN ROUTES field, 则此前通告的 route 中, destination (表示为 IP prefix) 包含在该 field 中的那些 route SHALL 从 Adj-RIB-In 中移除. 此 BGP speaker SHALL 运行其 Decision Process, 因为此前通告的 route 不再可用.

如果 UPDATE message 包含 feasible route, 则按如下方式用该 route 更新 Adj-RIB-In: 如果新 route 的 NLRI 与 Adj-RIB-In 中当前存储 route 的 NLRI 相同, 则新 route SHALL 替换 Adj-RIB-In 中较旧的 route, 从而隐式地将较旧 route 从服务中撤销. 否则, 如果 Adj-RIB-In 中没有 NLRI 与新 route 相同的 route, 则新 route SHALL 放入 Adj-RIB-In.

BGP speaker 一旦更新 Adj-RIB-In, speaker SHALL 运行其 Decision Process.

9.1. Decision Process

Decision Process 通过将 local Policy Information Base (PIB) 中的 policy 应用于其 Adj-RIBs-In 中存储的 route, 选择随后要通告的 route. Decision Process 的输出是要通告给 peer 的 route 集合; 选出的 route 根据 policy 存储在 local speaker 的 Adj-RIBs-Out 中.

此处描述的 BGP Decision Process 是概念性的, 只要 implementation 支持所描述的 functionality 并表现出相同的 externally visible behavior, 就不必完全按此处描述的方式实现.

selection process 通过定义一个 function 来形式化. 该 function 以给定 route 的 attribute 为 argument, 并返回以下之一: (a) 一个 non-negative integer, 表示该 route 的 degree of preference; 或 (b) 一个 value, 表示该 route 不符合安装到 Loc-RIB 的资格, 并会被排除在下一阶段 route selection 之外.

计算给定 route 的 degree of preference 的 function SHALL NOT 使用以下任一项作为 input: 其他 route 的存在, 其他 route 的不存在, 或其他 route 的 path attribute. route selection 随后包括对每条 feasible route 分别应用 degree-of-preference function, 然后选择具有最高 degree of preference 的 route.

Decision Process 处理 Adj-RIBs-In 中包含的 route, 并负责:

  • 选择 speaker 本地要使用的 route
  • 选择要通告给其他 BGP peer 的 route
  • route aggregation 和 route information reduction

Decision Process 分为三个不同 phase, 每个 phase 由不同 event 触发:

a) Phase 1 负责为从 peer 收到的每条 route 计算 degree of preference.

b) Phase 2 在 Phase 1 完成时调用. 它负责从每个唯一 destination 的所有可用 route 中选出 best route, 并负责将每条选定 route 安装到 Loc-RIB.

c) Phase 3 在 Loc-RIB 修改后调用. 它负责按 PIB 中包含的 policy 将 Loc-RIB 中的 route 传播给每个 peer. route aggregation 和 information reduction 可选地在此 phase 执行.

9.1.1. Phase 1: Degree of Preference 的计算 (Calculation of Degree of Preference)

当 local BGP speaker 从 peer 收到通告 new route, replacement route 或 withdrawn route 的 UPDATE message 时, 会调用 Phase 1 decision function.

Phase 1 decision function 是一个 separate process, 在没有更多工作要做时完成.

Phase 1 decision function 在操作 Adj-RIB-In 中的 route 之前锁定该 Adj-RIB-In, 并在操作其中所有 new route 或 unfeasible route 后解锁.

对于每条新收到的或替换的 feasible route, local BGP speaker 按如下方式确定 degree of preference:

如果 route 是从 internal peer 学到的, 则要么把 LOCAL_PREF attribute 的值作为 degree of preference, 要么 local system 基于预配置 policy information 计算该 route 的 degree of preference. 注意, 后一种方式可能导致 persistent routing loop 的形成.

如果 route 是从 external peer 学到的, local BGP speaker 基于预配置 policy information 计算 degree of preference. 如果返回值表示该 route 不符合资格, 则该 route MAY NOT 作为下一阶段 route selection 的 input; 否则, 返回值 MUST 作为任何 IBGP re-advertisement 中的 LOCAL_PREF value.

此 policy information 的确切性质以及关联计算是 local matter.

9.1.2. Phase 2: Route Selection

Phase 2 decision function 在 Phase 1 完成时调用. Phase 2 function 是一个 separate process, 在没有更多工作要做时完成. Phase 2 process 会考虑 Adj-RIBs-In 中所有符合资格的 route.

Phase 2 decision function 在 Phase 3 decision function 运行时被阻塞. Phase 2 function 在开始其功能之前锁定所有 Adj-RIBs-In, 并在完成时解锁.

如果某条 BGP route 的 NEXT_HOP attribute 表示一个不可解析的 address, 或者如果该 route 安装到 routing table 后会变得不可解析, 则该 BGP route MUST 从 Phase 2 decision function 中排除.

如果某条 BGP route 的 AS_PATH attribute 包含 AS loop, 则该 BGP route SHOULD 从 Phase 2 decision function 中排除. AS loop detection 通过扫描完整 AS path (如 AS_PATH attribute 中所指定) 并验证 local system 的 autonomous system number 未出现在 AS path 中来执行. 配置为接受 AS path 中包含自身 autonomous system number 的 route 的 BGP speaker 的操作不在本文档范围内.

AS 内的 BGP speaker 不得在 route selection 上做出会造成 forwarding loop 的冲突决策, 这一点至关重要.

对于 Adj-RIBs-In 中存在 feasible route 的每个 destination 集合, local BGP speaker 识别满足以下条件的 route:

a) 在通向同一 destination 集合的所有 route 中具有最高 degree of preference, 或

b) 是通向该 destination 的唯一 route, 或

c) 作为 Section 9.1.2.2 中指定的 Phase 2 tie-breaking rule 的结果被选中.

local speaker SHALL 随后将该 route 安装到 Loc-RIB, 并替换 Loc-RIB 当前持有的通向同一 destination 的任何 route. 当新的 BGP route 安装到 routing table 中时, 必须注意从 routing table 中移除现在被视为 invalid 的, 通向同一 destination 的既有 route. 新 BGP route 是否替换 routing table 中的既有 non-BGP route 取决于 BGP speaker 上配置的 policy.

local speaker MUST 从所选 route 的 NEXT_HOP attribute 确定 immediate next-hop address (见 Section 5.1.3). 如果 immediate next-hop 或到 NEXT_HOP 的 IGP cost (其中 NEXT_HOP 通过 IGP route 解析) 发生变化, 则 MUST 重新执行 Phase 2 route selection.

注意, 虽然 BGP route 不需要以 immediate next-hop 安装到 routing table 中, implementation 仍 MUST 确保关联的 NEXT_HOP address 在沿 BGP route 转发 packet 之前被解析为 immediate (directly connected) next-hop address, 并确保该 address (或多个 address) 最终用于实际 packet forwarding.

不可解析的 route SHALL 从 Loc-RIB 和 routing table 中移除. 不过, 对应的不可解析 route SHOULD 保留在 Adj-RIBs-In 中 (以防它们之后变得可解析).

9.1.2.1. Route Resolvability Condition

如 Section 9.1.2 中所述, BGP speaker SHOULD 将不可解析 route 从 Phase 2 decision 中排除. 这确保只有 valid route 被安装到 Loc-RIB 和 routing table 中.

route resolvability condition 定义如下:

  1. 只引用 intermediate network address 的 route Rte1, 如果 routing table 中至少包含一条可解析 route Rte2, 该 route 与 Rte1 的 intermediate network address 匹配且不会递归地 (直接或间接) 通过 Rte1 解析, 则 Rte1 被视为可解析. 如果存在多条匹配 route, SHOULD 只考虑 longest matching route.

  2. 引用 interface 的 route (无论是否带 intermediate address), 如果所引用 interface 的 state 为 active, 且该 interface 上启用了 IP processing, 则被视为可解析.

BGP route 不引用 interface, 但可以通过 routing table 中的 route 解析, 而这些 route 可以是两种类型之一 (指定 interface 的 route, 或不指定 interface 的 route). IGP route 和到 directly connected network 的 route 预期会指定 outgoing interface. static route 可以指定 outgoing interface, intermediate address, 或二者都指定.

注意, 在 BGP speaker 的 routing table 中不包含与该 BGP route 的 NEXT_HOP 匹配的 route 时, BGP route 被视为不可解析. 相互递归的 route (彼此解析或解析自身的 route) 也无法通过 resolvability check.

还有一点也很重要: implementation 不应考虑那些一旦安装到 routing table 中就会变得不可解析的 feasible route, 即使它们的 NEXT_HOP 按 routing table 当前内容可解析 (这类 route 的例子是相互递归 route). 此检查确保 BGP speaker 不会在 routing table 中安装将被移除且 speaker 无法使用的 route. 因而, 除了 local routing table stability 之外, 此检查还改善了 protocol 在网络中的行为.

每当 BGP speaker 识别出某条 route 因相互递归而无法通过 resolvability check 时, SHOULD 记录一条 error message.

9.1.2.2. Breaking Ties (Phase 2)

在 Adj-RIBs-In 中, BGP speaker 可能有多条通向同一 destination 且具有相同 degree of preference 的 route. local speaker 只能选择其中一条 route 放入关联的 Loc-RIB. local speaker 会考虑所有具有相同 degree of preference 的 route, 包括从 internal peer 收到的 route 和从 external peer 收到的 route.

以下 tie-breaking procedure 假定对于每条 candidate route, 一个 autonomous system 内的所有 BGP speaker 都能够确定到该 route 的 NEXT_HOP attribute 所表示 address 的 path cost (内部距离), 并遵循相同的 route selection algorithm.

tie-breaking algorithm 首先考虑通向同一 destination 的所有同等偏好 route, 然后选择要从考虑中移除的 route. 当只剩一条 route 供考虑时, algorithm 结束. criterion MUST 按给定顺序应用.

若干 criterion 用 pseudo-code 描述. 注意, 所示 pseudo-code 是为清晰而非效率而选择的. 它并不指定某种特定 implementation. BGP implementation MAY 使用任何能产生与此处描述相同结果的 algorithm.

a) 从考虑中移除那些在其 AS_PATH attribute 中拥有最少 AS number 数量方面并列失败的所有 route. 注意, 在计算该数量时, AS_SET 计为 1, 与 set 中有多少 AS 无关.

b) 从考虑中移除那些在其 Origin attribute 中拥有最低 Origin number 方面并列失败的所有 route.

c) 从考虑中移除具有较不优先 MULTI_EXIT_DISC attribute 的 route. MULTI_EXIT_DISC 只能在从同一个 neighboring AS 学到的 route 之间比较 (neighboring AS 由 AS_PATH attribute 确定). 没有 MULTI_EXIT_DISC attribute 的 route 被视为具有最低 MULTI_EXIT_DISC value.

这也由以下 procedure 描述:

for m = all routes still under consideration
for n = all routes still under consideration
if (neighborAS(m) == neighborAS(n)) and (MED(n) < MED(m))
remove route m from consideration

在上述 pseudo-code 中, MED(n) 是返回 route n 的 MULTI_EXIT_DISC attribute value 的 function. 如果 route n 没有 MULTI_EXIT_DISC attribute, 该 function 返回最低 MULTI_EXIT_DISC value (即 0).

类似地, neighborAS(n) 是返回接收该 route 的 neighboring AS 的 function. 如果该 route 通过 IBGP 学到且另一个 IBGP speaker 并未 originate 该 route, 则它是另一个 IBGP speaker 学到该 route 的 neighboring AS. 如果该 route 通过 IBGP 学到且另一个 IBGP speaker 要么 (a) originate 了该 route, 要么 (b) 通过 aggregation 创建了该 route 并且 aggregated route 的 AS_PATH attribute 为空或以 AS_SET 开始, 则它是 local AS.

如果某个 MULTI_EXIT_DISC attribute 在 route 于 IBGP 中 re-advertisement 之前被移除, MAY 仍基于收到的 EBGP MULTI_EXIT_DISC attribute 进行比较. 如果 implementation 选择移除 MULTI_EXIT_DISC, 则可选的 MULTI_EXIT_DISC 比较如果执行, MUST 只在 EBGP-learned route 之间执行. 最佳 EBGP-learned route 随后可在移除 MULTI_EXIT_DISC attribute 后与 IBGP-learned route 比较. 如果从一部分 EBGP-learned route 中移除 MULTI_EXIT_DISC, 而选出的 "best" EBGP-learned route 没有移除 MULTI_EXIT_DISC, 则与 IBGP-learned route 比较时必须使用 MULTI_EXIT_DISC. 对于 IBGP-learned route, 在 route comparison 到达 Decision Process 的此步骤时, MUST 使用 MULTI_EXIT_DISC. 将 EBGP-learned route 的 MULTI_EXIT_DISC 纳入与 IBGP-learned route 的比较, 然后移除 MULTI_EXIT_DISC attribute 并通告该 route, 已被证明会造成 routing loop.

d) 如果至少一条 candidate route 是通过 EBGP 收到的, 则从考虑中移除所有通过 IBGP 收到的 route.

e) 从考虑中移除具有较不优先内部 cost 的所有 route. route 的内部 cost 通过使用 routing table 计算到该 route 的 NEXT_HOP 的 metric 来确定. 如果某条 route 的 NEXT_HOP hop 可达但无法确定 cost, 则应跳过此步骤 (等价于将所有 route 视为具有相同 cost).

这也由以下 procedure 描述:

for m = all routes still under consideration
for n = all routes in still under consideration
if (cost(n) is lower than cost(m))
remove m from consideration

在上述 pseudo-code 中, cost(n) 是返回到 route 的 NEXT_HOP attribute 中指定 address 的 path cost (内部距离) 的 function.

f) 从考虑中移除除由最低 BGP Identifier value 的 BGP speaker 通告的 route 之外的所有 route.

g) 优先选择从最低 peer address 收到的 route.

9.1.3. Phase 3: Route Dissemination

Phase 3 decision function 在 Phase 2 完成时或以下任一 event 发生时调用:

a) 到 local destination 的 Loc-RIB 中 route 发生变化

b) 通过 BGP 外部方式学到的 locally generated route 发生变化

c) 建立新的 BGP speaker connection

Phase 3 function 是一个 separate process, 在没有更多工作要做时完成. Phase 3 routing decision function 在 Phase 2 decision function 运行时被阻塞.

Loc-RIB 中的所有 route 都按 configured policy 处理到 Adj-RIBs-Out. 该 policy MAY 将 Loc-RIB 中某条 route 排除在安装到特定 Adj-RIB-Out 之外. 除非 routing table 能够适当地转发该 route 所描述的 destination 和 NEXT_HOP, 否则 route SHALL NOT 安装到 Adj-RIB-Out 中. 如果 Loc-RIB 中某条 route 被排除在某个特定 Adj-RIB-Out 之外, 则此前在该 Adj-RIB-Out 中通告的 route MUST 通过 UPDATE message 从服务中撤销 (见 9.2).

route aggregation 和 information reduction 技术 (见 Section 9.2.2.1) 可以可选地应用.

任何导致 route 被添加到 Adj-RIB-Out 但未同时添加到 local BGP speaker forwarding table 的 local policy, 都不在本文档范围内.

当 Adj-RIBs-Out 和 routing table 的更新完成后, local BGP speaker 执行 9.2 中的 Update-Send Process.

9.1.4. Overlapping Routes

BGP speaker 可以向另一个 BGP speaker 传输带有 overlapping Network Layer Reachability Information (NLRI) 的 route. 当一组 destination 在多条不匹配 route 中被标识时, 会发生 NLRI overlap. 由于 BGP 使用 IP prefix 编码 NLRI, overlap 总是表现为子集关系. 描述较小 destination 集合的 route (较长 prefix) 称为比描述较大 destination 集合的 route (较短 prefix) 更 specific; 类似地, 描述较大 destination 集合的 route 称为比描述较小 destination 集合的 route 更 less specific.

优先关系实际上将 less specific route 分解为两部分:

  • 仅由 less specific route 描述的一组 destination, 以及
  • 由 less specific route 与 more specific route 的 overlap 描述的一组 destination

由 overlap 描述的 destination 集合表示 less specific route 中 feasible 但当前未使用的一部分. 如果之后撤销 more specific route, 则由 overlap 描述的 destination 集合仍可使用 less specific route 到达.

当 BGP speaker 收到 overlapping route 时, Decision Process MUST 基于 configured acceptance policy 考虑这两条 route. 如果 less specific route 和 more specific route 都被接受, 则 Decision Process MUST 在 Loc-RIB 中安装 less specific route 和 more specific route, 或者聚合这两条 route 并在 Loc-RIB 中安装 aggregated route, 前提是这两条 route 具有相同的 NEXT_HOP attribute value.

如果 BGP speaker 决定 aggregate, 它 SHOULD 要么将用于形成 aggregate 的所有 AS 包含在 AS_SET 中, 要么向 route 添加 ATOMIC_AGGREGATE attribute. 该 attribute 现在主要是 informational. 随着不支持 classless routing 的 IP routing protocol 被淘汰, 以及不支持 classless routing 的 router 和 host implementation 被淘汰, 不再需要 disaggregation. route SHOULD NOT 被 disaggregate. 特别是, 携带 ATOMIC_AGGREGATE attribute 的 route MUST NOT 被 disaggregate. 也就是说, 该 route 的 NLRI 不能更 specific. 沿此类 route 转发并不保证 IP packet 实际上只经过 route 的 AS_PATH attribute 中列出的 AS.

9.2. Update-Send Process

Update-Send Process 负责向所有 peer 通告 UPDATE message. 例如, 它把 Decision Process 选出的 route 分发给其他 BGP speaker, 这些 speaker 可能位于同一 autonomous system 或 neighboring autonomous system.

如果 BGP speaker 从 internal peer 收到 UPDATE message, 则接收方 BGP speaker SHALL NOT 将该 UPDATE message 中包含的 routing information 重新分发给其他 internal peer (除非该 speaker 充当 BGP Route Reflector [RFC2796]).

作为 route selection process 的 Phase 3 的一部分, BGP speaker 已更新其 Adj-RIBs-Out. 所有 newly installed route, 以及所有没有 replacement route 的 newly unfeasible route, SHALL 通过 UPDATE message 通告给其 peer.

如果从 Adj-RIB-Out 通告给定 feasible BGP route 会生成一条包含与此前通告相同 BGP route 的 UPDATE message, 则 BGP speaker SHOULD NOT 通告该 route.

Loc-RIB 中所有标记为 unfeasible 的 route SHALL 被移除. 其自身 autonomous system 内 reachable destination 的变化也 SHALL 在 UPDATE message 中通告.

如果由于 UPDATE message 最大尺寸限制 (见 Section 4), 单条 route 无法放入 message 中, BGP speaker MUST NOT 将该 route 通告给其 peer, 并且 MAY 选择在本地记录 error.

9.2.1. 控制 Routing Traffic Overhead (Controlling Routing Traffic Overhead)

BGP protocol 会限制 routing traffic (即 UPDATE message) 的数量, 以限制通告 UPDATE message 所需的 link bandwidth, 以及 Decision Process 处理 UPDATE message 中所含信息所需的 processing power.

9.2.1.1. Route Advertisement 的频率 (Frequency of Route Advertisement)

MinRouteAdvertisementIntervalTimer parameter 确定 BGP speaker 向 peer 对特定 destination 通告和/或撤销 route 之间必须经过的最小时间. 该 rate-limiting procedure 按每个 destination 应用, 尽管 MinRouteAdvertisementIntervalTimer 的值是按每个 BGP peer 设置的.

BGP speaker 发送给 peer 的两条 UPDATE message, 如果通告通向共同 destination 集合的 feasible route 和/或撤销 unfeasible route, 则 MUST 至少相隔 MinRouteAdvertisementIntervalTimer. 这只能通过为每个共同 destination 集合维护单独 timer 来实现. 这会是不合理的 overhead. 任何技术只要确保 BGP speaker 发送给 peer 的两条 UPDATE message 之间的 interval 至少为 MinRouteAdvertisementIntervalTimer, 且也确保该 interval 具有 constant upper bound, 就是可接受的. 这些 UPDATE message 通告通向共同 destination 集合的 feasible route 和/或撤销 unfeasible route.

由于 autonomous system 内需要快速 convergence, 因此 SHOULD 要么 (a) internal peer 使用的 MinRouteAdvertisementIntervalTimer 短于 external peer 使用的 MinRouteAdvertisementIntervalTimer, 要么 (b) 本节描述的 procedure SHOULD NOT 应用于发送给 internal peer 的 route.

此 procedure 不限制 route selection 的速率, 只限制 route advertisement 的速率. 如果在等待 MinRouteAdvertisementIntervalTimer 过期期间多次选择了新 route, 则 SHALL 在 MinRouteAdvertisementIntervalTimer 结束时通告最后选出的 route.

9.2.1.2. Route Origination 的频率 (Frequency of Route Origination)

MinASOriginationIntervalTimer parameter 确定连续通告 UPDATE message 之间必须经过的最小时间, 这些 UPDATE message 报告 advertising BGP speaker 自身 autonomous system 内的变化.

9.2.2. Routing Information 的高效组织 (Efficient Organization of Routing Information)

选择要通告的 routing information 后, BGP speaker 可以使用多种方法以高效方式组织这些信息.

9.2.2.1. Information Reduction

information reduction 可能意味着 policy control granularity 的降低 - 信息聚合后, 相同 policy 适用于 equivalence class 中的所有 destination 和 path.

Decision Process 可选地通过以下方法之一减少放入 Adj-RIBs-Out 的信息量:

a) Network Layer Reachability Information (NLRI):

destination IP address 可以表示为 IP address prefix. 在 address structure 与 autonomous system administrator 控制下的 system 之间存在对应关系的情况下, 可以减少 UPDATE message 中携带的 NLRI size.

b) AS_PATHs:

AS path information 可以表示为有序 AS_SEQUENCE 或无序 AS_SET. AS_SET 用于 Section 9.2.2.2 中描述的 route aggregation algorithm. 它们通过只列出每个 AS number 一次来减少 AS_PATH information 的 size, 不论该 AS number 在被 aggregation 的多个 AS_PATH 中出现过多少次.

AS_SET 暗示 NLRI 中列出的 destination 可以通过至少经过某些 constituent autonomous system 的 path 到达. AS_SET 提供足够信息来避免 routing information loop; 但其使用可能剪除潜在 feasible path, 因为这些 path 不再以 AS_SEQUENCE 形式单独列出. 实践中这可能不是问题, 因为一旦 IP packet 到达一组 autonomous system 的边缘, BGP speaker 很可能拥有更详细的 path information, 并且能够区分通向 destination 的单独 path.

9.2.2.2. Aggregating Routing Information

aggregation 是组合多条不同 route 的特性, 使得可以通告单条 route 的过程. aggregation 可以作为 Decision Process 的一部分执行, 以减少放入 Adj-RIBs-Out 的 routing information 数量.

aggregation 减少 BGP speaker 必须存储并与其他 BGP speaker 交换的信息量. 可以通过将以下 procedure 分别应用于相同 type 的 path attribute 和 Network Layer Reachability Information 来 aggregate route.

具有不同 MULTI_EXIT_DISC attribute 的 route SHALL NOT 被 aggregate.

如果 aggregated route 在其 AS_PATH attribute 中以 AS_SET 作为第一个 element, 则 originate 该 route 的 router SHOULD NOT 随该 route 通告 MULTI_EXIT_DISC attribute.

type code 不同的 path attribute 不能一起 aggregate. type code 相同的 path attribute 可以按以下规则 aggregate:

NEXT_HOP:

aggregate 具有不同 NEXT_HOP attribute 的 route 时, aggregated route 的 NEXT_HOP attribute SHALL 标识执行 aggregation 的 BGP speaker 上的一个 interface.

ORIGIN attribute:

如果要 aggregate 的 route 中至少一条 route 的 ORIGIN 值为 INCOMPLETE, 则 aggregated route MUST 具有值为 INCOMPLETE 的 ORIGIN attribute. 否则, 如果要 aggregate 的 route 中至少一条 route 的 ORIGIN 值为 EGP, 则 aggregated route MUST 具有值为 EGP 的 ORIGIN attribute. 在所有其他情况下, aggregated route 的 ORIGIN attribute value 为 IGP.

AS_PATH attribute:

如果要 aggregate 的 route 具有相同的 AS_PATH attribute, 则 aggregated route 具有与每条单独 route 相同的 AS_PATH attribute.

为了 aggregate AS_PATH attribute, 我们将 AS_PATH attribute 内的每个 AS 建模为 tuple <type, value>, 其中 "type" 标识该 AS 所属 path segment 的 type (例如 AS_SEQUENCE, AS_SET), "value" 标识 AS number. 如果要 aggregate 的 route 具有不同 AS_PATH attribute, 则 aggregated AS_PATH attribute SHALL 满足以下所有条件:

  • aggregated AS_PATH 中所有 type 为 AS_SEQUENCE 的 tuple SHALL 出现在要 aggregate route 的初始集合中的所有 AS_PATH 中.
  • aggregated AS_PATH 中所有 type 为 AS_SET 的 tuple SHALL 出现在初始集合中的至少一个 AS_PATH 中 (它们可以作为 AS_SET 或 AS_SEQUENCE type 出现).
  • 对于 aggregated AS_PATH 中 type 为 AS_SEQUENCE 的每个 tuple X, 如果 X 位于 aggregated AS_PATH 中 tuple Y 之前, 则在初始集合中包含 Y 的每个 AS_PATH 中, X 都位于 Y 之前, 无论 Y 的 type 是什么.
  • type 为 AS_SET 且 value 相同的 tuple SHALL NOT 在 aggregated AS_PATH 中出现超过一次.
  • type 为 AS_SEQUENCE 且 value 相同的多个 tuple 只有在与相同 type 和 value 的另一个 tuple 相邻时, 才可以出现在 aggregated AS_PATH 中.

implementation 可以选择任何符合这些规则的 algorithm. 至少, conforming implementation SHALL 能够执行以下 algorithm, 该 algorithm 满足上述所有条件:

  • 确定要 aggregate 的 route 的所有 AS_PATH attribute 共有的最长 leading sequence of tuple (如上定义). 将此 sequence 作为 aggregated AS_PATH attribute 的 leading sequence.
  • 将要 aggregate 的 route 的 AS_PATH attribute 中剩余 tuple 的 type 设置为 AS_SET, 并将它们附加到 aggregated AS_PATH attribute.
  • 如果 aggregated AS_PATH 中有多个 tuple 具有相同 value (无论 tuple type 如何), 则通过从 aggregated AS_PATH attribute 中删除 type 为 AS_SET 的 tuple, 消除除一个之外的所有此类 tuple.
  • 对 aggregated AS_PATH 中每一对 adjacent tuple: 如果两个 tuple 具有相同 type, 则将它们合并, 只要这不会产生 length 大于 255 的 segment.

Appendix F, Section F.6 给出了另一个满足这些条件且支持更复杂 policy configuration 的 algorithm.

ATOMIC_AGGREGATE:

如果要 aggregate 的 route 中至少一条具有 ATOMIC_AGGREGATE path attribute, 则 aggregated route SHALL 也具有此 attribute.

AGGREGATOR:

要 aggregate 的 route 中的所有 AGGREGATOR attribute MUST NOT 包含在 aggregated route 中. 执行 route aggregation 的 BGP speaker MAY 附加一个新的 AGGREGATOR attribute (见 Section 5.1.7).

9.3. Route Selection Criteria

一般来说, 用于在多个 alternative 之间比较 route 的附加规则不在本文档范围内. 有两个例外:

  • 如果 local AS 出现在正在考虑的新 route 的 AS path 中, 则该新 route 不能被视为优于任何其他 route (假设 speaker 被配置为接受此类 route). 如果实际使用这样的 route, 可能导致 routing loop.

  • 为实现成功的分布式操作, 只能选择具有稳定可能性的 route. 因此, AS SHOULD 避免使用 unstable route, 并且 SHOULD NOT 对其 route choice 进行快速自发变化. 对 "unstable" 和 "rapid" (上一句中的术语) 的量化需要经验, 但原则是明确的. unstable route 可以被 "penalized" (例如使用 [RFC2439] 中描述的 procedure).

9.4. Originating BGP routes

BGP speaker 可以通过将其他方式 (例如通过 IGP) 获得的 routing information 注入 BGP 来 originate BGP route. originate BGP route 的 BGP speaker 会通过将这些 route 送入 Decision Process (见 Section 9.1) 来为其分配 degree of preference (例如按 local configuration). 这些 route MAY 也作为 Update Process 的一部分分发给 local AS 内的其他 BGP speaker (见 Section 9.2). 是否在 AS 内通过 BGP 分发 non-BGP-acquired route 的决定取决于 AS 内环境 (例如 IGP type), 并且 SHOULD 通过 configuration 控制.