用于 IBGP 扩展的 BGP 联盟
了解 BGP 联盟
BGP 联合体是解决 BGP 全网状要求所产生的扩展问题的另一种方式。BGP 联合体有效地将大型自治系统 (AS) 分解为次自治系统 (子 AS)。每个子 AS 必须在联合体 AS 中通过子 AS 编号唯一标识。通常,子 AS 编号取自 64,512 和 65,535 之间的专用 AS 编号。
在子 AS 中,存在相同的内部 BGP (IBGP) 全网状要求。使用标准外部 BGP (EBGP) 与其他联合体建立连接,子 AS 外部的对等方被视为外部。为了避免出现路由环路,子 AS 使用联合序列,该序列像 AS 路径一样运行,但仅使用私下分配的子 AS 编号。
联合体 AS 在其他联合体 AS 中显示为整体。其他 AS 接收的 AS 路径仅显示全局分配的 AS 编号。它不包括联合体序列或私下分配的子 AS 编号。当从联合体 AS 播发路由时,子 AS 编号将被移除。 图 1 显示一个 AS,分为四个联合体

图 1 显示 AS 3,分为四个子 AS:64517、64550、65300 和 65410,这些子 AS 3 通过 EBGP 会话进行链接。由于联合体通过 EBGP 连接,因此无需全网状连接。EBGP 路由被重新转为其他子 AS。
另请参阅
示例:配置 BGP 联合体
此示例说明如何配置 BGP 联合体。
要求
配置网络接口。
配置外部对等会话。请参阅 示例:配置外部 BGP 点对点对等会话。
配置对等方之间的内部网关协议 (IGP) 会话。
配置路由策略以播发 BGP 路由。
概述
在 BGP 联合体中,联合体成员自治系统 (AS) 之间的链路必须是外部 BGP (EBGP) 链路,而不是内部 BGP (IBGP) 链路。
与 路由反射器类似,BGP 联合体减少了用于维护 IBGP 路由设备之间的连接的对等会话和 TCP 会话数。BGP 联合是解决 IBGP 全网状要求造成的扩展问题的一种方法。BGP 联盟有效地将大型 AS 分解为次自治系统。每个子 AS 必须在联合体 AS 中通过子 AS 编号唯一标识。通常,子 AS 编号取自 64512 和 65535 之间的专用 AS 编号。在子 AS 中,存在相同的 IBGP 全网状要求。使用标准 EBGP 与其他联合体建立连接,子 AS 外部的对等方被视为外部。为了避免出现路由环路,子 AS 使用联合序列,该序列像 AS 路径一样运行,但仅使用私下分配的子 AS 编号。
图 2 显示了一个示例网络,其中 AS 17 具有两个独立的联合体:子 AS 64512 和子 AS 64513,每个都有多个路由器。在子 AS 中,IGP 用于与内部对等方建立网络连接。在子 AS 之间,将建立 EBGP 对等会话。

拓扑
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
子 AS 64512 中的所有设备
set routing-options autonomous-system 64512 set routing-options confederation 17 members 64512 set routing-options confederation 17 members 64513 set protocols bgp group sub-AS-64512 type internal set protocols bgp group sub-AS-64512 local-address 192.168.5.1 set protocols bgp group sub-AS-64512 neighbor 192.168.8.1 set protocols bgp group sub-AS-64512 neighbor 192.168.15.1
子 AS 64512 中的边界设备
set protocols bgp group to-sub-AS-64513 type external set protocols bgp group to-sub-AS-64513 peer-as 64513 set protocols bgp group to-sub-AS-64513 neighbor 192.168.5.2
子 AS 64513 中的所有设备
set routing-options autonomous-system 64513 set routing-options confederation 17 members 64512 set routing-options confederation 17 members 64513 set protocols bgp group sub-AS-64513 type internal set protocols bgp group sub-AS-64513 local-address 192.168.5.2 set protocols bgp group sub-AS-64513 neighbor 192.168.9.1 set protocols bgp group sub-AS-64513 neighbor 192.168.16.1
子 AS 64513 中的边界设备
set protocols bgp group to-sub-AS-64512 type external set protocols bgp group to-sub-AS-64512 peer-as 64512 set protocols bgp group to-sub-AS-64512 neighbor 192.168.5.1
逐步过程
此过程显示子 AS 64512 中的设备的步骤。
语句 autonomous-system
将设置设备的子 AS 编号。
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置 BGP 联合体:
设置设备的子 AS 编号。
[edit routing-options] user@host# set autonomous-system 64512
在联合体中,将所有子 AS 包含在主 AS 中。
数字 17 表示主要 AS。语句
members
会列出主 AS 中的所有子 AS。[edit routing-options confederation] user@host# set 17 members 64512 user@host# set 17 members 64513
在子 AS 64512 中的边界设备上,配置与 AS 64513 中的边界设备的 EBGP 连接。
[edit protocols bgp group to-sub-AS-64513] user@host# set type external user@host# set neighbor 192.168.5.2 user@host# set peer-as 64513
配置 IBGP 组,以便与子 AS 64512 中的设备对等。
[edit protocols bgp group sub-AS-64512] user@host# set type internal user@host# set local-address 192.168.5.1 user@host# neighbor 192.168.8.1 user@host# neighbor 192.168.15.1
结果
在配置模式下,输入和 show protocols
命令以确认show routing-options
您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show routing-options autonomous-system 64512; confederation 17 members [ 64512 64513 ];
user@host# show protocols bgp { group to-sub-AS-64513 { # On the border devices only type external; peer-as 64513; neighbor 192.168.5.2; } group sub-AS-64512 { type internal; local-address 192.168.5.1; neighbor 192.168.8.1; neighbor 192.168.15.1; } }
完成设备配置后,请从配置模式进入 commit
。 对 sSub-AS 64513 重复这些步骤。
验证
确认配置工作正常。
验证 BGP 邻接方
目的
验证 BGP 是否在配置的接口上运行,以及每个邻接方地址的 BGP 会话是否处于活动状态。
行动
从 CLI 中输入 show bgp neighbor
命令。
示例输出
命令名称
user@host> show bgp neighbor Peer: 10.255.245.12+179 AS 35 Local: 10.255.245.13+2884 AS 35 Type: Internal State: Established (route reflector client)Flags: Sync Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: Preference LocalAddress HoldTime Cluster AddressFamily Rib-group Refresh Address families configured: inet-vpn-unicast inet-labeled-unicast Local Address: 10.255.245.13 Holdtime: 90 Preference: 170 Flags for NLRI inet-vpn-unicast: AggregateLabel Flags for NLRI inet-labeled-unicast: AggregateLabel Number of flaps: 0 Peer ID: 10.255.245.12 Local ID: 10.255.245.13 Active Holdtime: 90 Keepalive Interval: 30 NLRI advertised by peer: inet-vpn-unicast inet-labeled-unicast NLRI for this session: inet-vpn-unicast inet-labeled-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 300 Stale routes from peer are kept for: 60 Restart time requested by this peer: 300 NLRI that peer supports restart for: inet-unicast inet6-unicast NLRI that restart is negotiated for: inet-unicast inet6-unicast NLRI of received end-of-rib markers: inet-unicast inet6-unicast NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast Table inet.0 Bit: 10000 RIB State: restart is complete Send state: in sync Active prefixes: 4 Received prefixes: 6 Suppressed due to damping: 0 Table inet6.0 Bit: 20000 RIB State: restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 2 Suppressed due to damping: 0 Last traffic (seconds): Received 3 Sent 3 Checked 3 Input messages: Total 9 Updates 6 Refreshes 0 Octets 403 Output messages: Total 7 Updates 3 Refreshes 0 Octets 365 Output Queue[0]: 0 Output Queue[1]: 0 Trace options: detail packets Trace file: /var/log/bgpgr size 131072 files 10
含义
输出显示包含详细会话信息的 BGP 邻接方列表。验证以下信息:
列出了每个配置的对等邻接方。
对于
State
每个 BGP 会话。Established
对于
Type
每个对等方,均配置为正确的类型(内部或外部)。对于
AS
,BGP 邻接方的 AS 编号是正确的。
验证 BGP 组
目的
验证 BGP 组配置是否正确。
行动
从 CLI 中输入 show bgp group
命令。
示例输出
命令名称
user@host> show bgp group Group Type: Internal AS: 10045 Local AS: 10045 Name: pe-to-asbr2 Flags: Export Eval Export: [ match-all ] Total peers: 1 Established: 1 10.0.0.4+179 bgp.l3vpn.0: 1/1/0 vpn-green.inet.0: 1/1/0 Groups: 1 Peers: 1 External: 0 Internal: 1 Down peers: 0 Flaps: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending bgp.l3vpn.0 1 1 0 0 0 0
含义
输出显示包含详细组信息的 BGP 组列表。验证以下信息:
列出了每个配置的组。
对于
AS
,每个组的远程 AS 均已正确配置。对于
Local AS
每个组的本地 AS,配置正确。对于
Group Type
,每个组都有正确的类型(内部或外部)。对于
Total peers
,显示组内的预期对等方数量。对于
Established
,组内预期有 BGP 会话处于该Established
状态。组内所有对等方的 IP 地址均存在。
验证 BGP 摘要信息
目的
验证 BGP 配置是否正确。
行动
从 CLI 中输入 show bgp summary
命令。
示例输出
命令名称
user@host> show bgp summary Groups: 1 Peers: 3 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 6 4 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Damped... 10.0.0.2 65002 88675 88652 0 2 42:38 2/4/0 0/0/0 10.0.0.3 65002 54528 54532 0 1 2w4d22h 0/0/0 0/0/0 10.0.0.4 65002 51597 51584 0 0 2w3d22h 2/2/0 0/0/0
含义
输出显示 BGP 会话信息的摘要。验证以下信息:
对于
Groups
,显示配置的组总数。对于
Peers
,显示 BGP 对等方总数。对于
Down Peers
,未建立的对等方总数为 0。如果此值不为零,则尚未建立一个或多个对等会话。在下方
Peer
,显示每个配置对等方的 IP 地址。在下
AS
,每个配置的对等方对等方 AS 是正确的。在下
Up/Dwn State
,BGP 状态反映从邻接方接收的路径数、已接受的这些路径的数量以及被抑制的路由数(如 0/0/0)。如果字段为Active
,则表示在建立 BGP 会话时出现问题。