5.1.2. AS_PATH
5.1.2. AS_PATH
AS_PATH 是 well-known mandatory attribute. 此 attribute 标识本 UPDATE message 中携带的 routing information 所经过的 autonomous system. 该列表的组成部分可以是 AS_SET 或 AS_SEQUENCE.
当 BGP speaker 传播它从另一个 BGP speaker 的 UPDATE message 中学到的 route 时, 它会根据接收该 route 的 BGP speaker 所在位置修改该 route 的 AS_PATH attribute:
a) 如果给定 BGP speaker 将 route 通告给 internal peer, 通告 speaker SHALL NOT 修改与该 route 关联的 AS_PATH attribute.
b) 如果给定 BGP speaker 将 route 通告给 external peer, 通告 speaker 按如下方式更新 AS_PATH attribute:
-
如果 AS_PATH 的第一个 path segment 类型为 AS_SEQUENCE, local system 会将自己的 AS number 作为 sequence 的最后一个元素前置 (即相对于 protocol message 中 octet 位置放到最左位置). 如果前置操作导致 AS_PATH segment overflow (即超过 255 个 AS), 则它 SHOULD 前置一个新的 AS_SEQUENCE 类型 segment, 并将自己的 AS number 前置到该新 segment 中.
-
如果 AS_PATH 的第一个 path segment 类型为 AS_SET, local system 会在 AS_PATH 前置一个新的 AS_SEQUENCE 类型 path segment, 并在该 segment 中包含自己的 AS number.
-
如果 AS_PATH 为空, local system 会创建一个 AS_SEQUENCE 类型 path segment, 将自己的 AS 放入该 segment, 并将该 segment 放入 AS_PATH.
当 BGP speaker 创建 route 时:
a) origin speaker 在发送给 external peer 的所有 UPDATE message 的 AS_PATH attribute 中, 将自己的 AS number 放入 AS_SEQUENCE 类型 path segment. 在这种情况下, origin speaker 的 autonomous system AS number 是该 path segment 中唯一条目, 且该 path segment 是 AS_PATH attribute 中唯一 segment.
b) origin speaker 在发送给 internal peer 的所有 UPDATE message 中插入空 AS_PATH attribute. (空 AS_PATH attribute 是 Length field 值为零的 attribute).
每当修改 AS_PATH attribute 需要插入或前置 local system 的 AS number 时, local system MAY 在 AS_PATH attribute 中插入/前置多个自己的 AS number 实例. 这由本地配置控制.