BGP 对等会话
了解外部 BGP 对等会话
要在对等自治系统 (AS) 之间建立点对点连接,请在点对点链路的每个接口上配置 BGP 会话。通常,此类会话是在 AS 外部的相邻主机的网络出口点进行。 图 1 显示了 BGP 对等会话的示例。

在 中 图 1,路由器 A 是用于 AS 3 的网关路由器,而路由器 B 是用于 AS 10 的网关路由器。对于任一 AS 内部流量,使用内部网关协议 (IGP)(例如 OSPF)。要在对等方 AS 之间路由流量,请使用 BGP 会话。
您将 BGP 路由设备排列成对等组。不同的对等组可以具有不同的组类型、AS 编号和路由反射器群集标识符。
要定义仅将指定 BGP 系统识别为对等方的 BGP 组,请通过包含一个或多个 neighbor
语句静态配置系统的所有对等方。对等方邻接方的地址可以是 IPv6 或 IPv4 地址。
随着外部 BGP (EBGP) 组数量的增加,支持大量 BGP 会话的能力可能会成为一个扩展问题。配置大量 BGP 邻接方的首选方法是配置几个组,每个组包含多个邻接方。支持较少 EBGP 组的扩展通常优于支持大量 EBGP 组。与每个组中具有多个对等组的几个 EBGP 组相比,在数百个 EBGP 组的情况下,这一点变得更加明显。
建立 BGP 对等方后, BGP 对等方不会自动播发非 BGP 路由。在每个支持 BGP 的设备上,都需要策略配置将本地、静态或 IGP 学习的路由导出到 BGP RIB 中,然后将其播发为 BGP 路由给其他对等方。默认情况下,BGP 的广告策略不会向对等方播发任何非 BGP 路由(如本地路由)。
在 SRX 系列设备上,您必须在指定接口或区域的所有接口上启用预期主机入站信息流。否则,默认情况下会丢弃发往此设备的入站流量。
例如,要在 SRX 系列设备的特定区域允许 BGP 流量,请使用以下步骤:
[edit] user@host# set security zones security-zone trust host-inbound-traffic protocols bgp
[edit] user@host# set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic protocols bgp
另请参阅
示例:配置外部 BGP 点对点对等会话
此示例说明如何配置 BGP 点对点对等会话。
要求
开始之前,如果默认 BGP 策略不足以满足您的网络需求,请配置路由策略以过滤传入 BGP 路由并播发 BGP 路由。
概述
图 2 显示了具有 BGP 对等会话的网络。在示例网络中,AS 17 中的设备 E 会向一组称为的 external-peers
对等方提供 BGP 对等会话。对等方 A、B 和 C 位于 AS 22 中,其 IP 地址为 10.10.10.2、10.10.10.6 和 10.10.10.10。对等 D 驻留在 AS 79 中,IP 地址为 10.21.7.2。此示例显示设备 E 上的配置。
拓扑

配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,移除任何换行符,更改与网络配置匹配所需的任何详细信息,然后将命令复制粘贴到层次结构级别的 [edit]
CLI 中。
set interfaces ge-1/2/0 unit 0 description to-A set interfaces ge-1/2/0 unit 0 family inet address 10.10.10.1/30 set interfaces ge-0/0/1 unit 5 description to-B set interfaces ge-0/0/1 unit 5 family inet address 10.10.10.5/30 set interfaces ge-0/1/0 unit 9 description to-C set interfaces ge-0/1/0 unit 9 family inet address 10.10.10.9/30 set interfaces ge-1/2/1 unit 21 description to-D set interfaces ge-1/2/1 unit 21 family inet address 10.21.7.1/30 set protocols bgp group external-peers type external set protocols bgp group external-peers peer-as 22 set protocols bgp group external-peers neighbor 10.10.10.2 set protocols bgp group external-peers neighbor 10.10.10.6 set protocols bgp group external-peers neighbor 10.10.10.10 set protocols bgp group external-peers neighbor 10.21.7.2 peer-as 79 set routing-options autonomous-system 17
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 Junos OS CLI 用户指南中的配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话,
将接口配置为对等方 A、B、C 和 D。
[edit interfaces] user@E# set ge-1/2/0 unit 0 description to-A user@E# set ge-1/2/0 unit 0 family inet address 10.10.10.1/30 user@E# set ge-0/0/1 unit 5 description to-B user@E# set ge-0/0/1 unit 5 family inet address 10.10.10.5/30 user@E# set ge-0/1/0 unit 9 description to-C user@E# set ge-0/1/0 unit 9 family inet address 10.10.10.9/30 user@E# set ge-1/2/1 unit 21 description to-D user@E# set ge-1/2/1 unit 21 family inet address 10.21.7.1/30
设置自治系统 (AS) 编号。
[edit routing-options] user@E# set autonomous-system 17
创建 BGP 组并添加外部邻接方地址。
[edit protocols bgp group external-peers] user@E# set neighbor 10.10.10.2 user@E# set neighbor 10.10.10.6 user@E# set neighbor 10.10.10.10
指定外部 AS 的自治系统 (AS) 编号。
[edit protocols bgp group external-peers] user@E# set peer-as 22
添加对等方 D 并在单个邻接方级别设置 AS 编号。
邻接方配置替代组配置。因此,虽然
peer-as 22
为组中所有其他邻接方设置,peer-as 79
则设置为邻接方 10.21.7.2。[edit protocols bgp group external-peers] user@E# set neighbor 10.21.7.2 peer-as 79
将对等类型设置为外部 BGP (EBGP)。
[edit protocols bgp group external-peers] user@E# set type external
结果
在配置模式下,输入 show interfaces
、 show protocols
和 show routing-options
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
[edit]
user@E# show interfaces
ge-1/2/0 {
unit 0 {
description to-A;
family inet {
address 10.10.10.1/30;
}
}
}
ge-0/0/1 {
unit 5 {
description to-B;
family inet {
address 10.10.10.5/30;
}
}
}
ge-0/1/0 {
unit 9 {
description to-C;
family inet {
address 10.10.10.9/30;
}
}
}
ge-1/2/1 {
unit 21 {
description to-D;
family inet {
address 10.21.7.1/30;
}
}
}
[edit]
user@E# show protocols
bgp {
group external-peers {
type external;
peer-as 22;
neighbor 10.10.10.2;
neighbor 10.10.10.6;
neighbor 10.10.10.10;
neighbor 10.21.7.2 {
peer-as 79;
}
}
}
[edit]
user@E# show routing-options
autonomous-system 17;
如果完成设备配置,请在配置模式下输入 commit
。
验证
确认配置工作正常。
验证 BGP 邻接方
目的
验证 BGP 是否在配置的接口上运行,以及每个邻接方地址的 BGP 会话是否处于活动状态。
行动
在操作模式下 show bgp neighbor
,运行 命令。
user@E> show bgp neighbor Peer: 10.10.10.2+179 AS 22 Local: 10.10.10.1+65406 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 10.10.10.2 Local ID: 10.10.10.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 BFD: disabled, down Local Interface: ge-1/2/0.0 NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 10 Sent 6 Checked 1 Input messages: Total 8522 Updates 1 Refreshes 0 Octets 161922 Output messages: Total 8433 Updates 0 Refreshes 0 Octets 160290 Output Queue[0]: 0 Peer: 10.10.10.6+54781 AS 22 Local: 10.10.10.5+179 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 10.10.10.6 Local ID: 10.10.10.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 1 BFD: disabled, down Local Interface: ge-0/0/1.5 NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 12 Sent 6 Checked 33 Input messages: Total 8527 Updates 1 Refreshes 0 Octets 162057 Output messages: Total 8430 Updates 0 Refreshes 0 Octets 160233 Output Queue[0]: 0 Peer: 10.10.10.10+55012 AS 22 Local: 10.10.10.9+179 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 10.10.10.10 Local ID: 10.10.10.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 2 BFD: disabled, down Local Interface: fe-0/1/0.9 NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 15 Sent 6 Checked 37 Input messages: Total 8527 Updates 1 Refreshes 0 Octets 162057 Output messages: Total 8429 Updates 0 Refreshes 0 Octets 160214 Output Queue[0]: 0 Peer: 10.21.7.2+61867 AS 79 Local: 10.21.7.1+179 AS 17 Type: External State: Established Flags: <ImportEval Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 10.21.7.2 Local ID: 10.10.10.1 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 3 BFD: disabled, down Local Interface: ge-1/2/1.21 NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 79) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 28 Sent 24 Checked 47 Input messages: Total 8521 Updates 1 Refreshes 0 Octets 161943 Output messages: Total 8427 Updates 0 Refreshes 0 Octets 160176 Output Queue[0]: 0
验证 BGP 组
目的
验证 BGP 组是否配置正确。
行动
在操作模式下 show bgp group
,运行 命令。
user@E> show bgp group Group Type: External Local AS: 17 Name: external-peers Index: 0 Flags: <> Holdtime: 0 Total peers: 4 Established: 4 10.10.10.2+179 10.10.10.6+54781 10.10.10.10+55012 10.21.7.2+61867 inet.0: 0/0/0/0 Groups: 1 Peers: 4 External: 4 Internal: 0 Down peers: 0 Flaps: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 0 0 0 0 0 0
验证 BGP 摘要信息
目的
验证 BGP 配置是否正确。
行动
在操作模式下 show bgp summary
,运行 命令。
user@E> show bgp summary Groups: 1 Peers: 4 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 0 0 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 10.10.10.2 22 8559 8470 0 0 2d 16:12:56 0/0/0/0 0/0/0/0 10.10.10.6 22 8566 8468 0 0 2d 16:12:12 0/0/0/0 0/0/0/0 10.10.10.10 22 8565 8466 0 0 2d 16:11:31 0/0/0/0 0/0/0/0 10.21.7.2 79 8560 8465 0 0 2d 16:10:58 0/0/0/0 0/0/0/0
示例:使用 IPv6 接口在逻辑系统上配置外部 BGP
此示例说明如何使用 IPv6 接口在逻辑系统上配置外部 BGP (EBGP) 点对点对等会话。
要求
在此示例中,除了设备初始化之外,不需要特殊配置。
概述
Junos OS 通过 IPv6 地址支持 EBGP 对等会话。当语句中 neighbor
指定了 IPv6 地址时,可以配置 IPv6 对等会话。此示例使用 EUI-64 生成自动应用于接口的 IPv6 地址。EUI-64 地址是 IPv6 地址,使用 IEEE EUI-64 格式用于地址的接口标识符部分(最后 64 位)。
或者,您也可以使用手动分配的 128 位 IPv6 地址来配置 EBGP 会话。
如果为接口使用 128 位链路本地地址,则必须包含该 local-interface
语句。此语句仅适用于 128 位 IPv6 链路本地地址,且必须配置 IPv6 EBGP 链路本地对等会话。
使用链路本地地址配置 EBGP 对等互连仅适用于直接连接的接口。不支持多霍普对等互对。
接口打开后,您可以使用 show interfaces terse
命令查看接口上生成的 EUI-64 生成的 IPv6 地址。您必须在 BGP neighbor
语句中使用这些已生成的地址。此示例演示了完整的端到端过程。
在此示例中,帧中继接口封装应用于逻辑隧道 (lt) 接口。这是一项要求,因为在接口上 lt 配置 IPv6 地址时,仅支持帧中继封装。
图 3 显示了具有 BGP 对等会话的网络。在示例网络中,路由器 R1 配置了五个逻辑系统。自治系统 (AS) 中的设备 E 17 具有与一组称为的 external-peers对等方的 BGP 对等会话。对等方 A、B 和 C 位于 AS 22 中。此示例显示逻辑系统 A 和逻辑系统 E 上的逐步配置。
拓扑

配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,移除任何换行符,更改与网络配置匹配所需的任何详细信息,将命令复制并粘贴到层级的 CLI 中 [edit]
,然后从配置模式进入 commit
。
设备 A
set logical-systems A interfaces lt-0/1/0 unit 1 description to-E set logical-systems A interfaces lt-0/1/0 unit 1 encapsulation frame-relay set logical-systems A interfaces lt-0/1/0 unit 1 dlci 1 set logical-systems A interfaces lt-0/1/0 unit 1 peer-unit 25 set logical-systems A interfaces lt-0/1/0 unit 1 family inet6 address 2001:db8:0:1::/64 eui-64 set logical-systems A interfaces lo0 unit 1 family inet6 address 2001:db8::1/128 set logical-systems A protocols bgp group external-peers type external set logical-systems A protocols bgp group external-peers peer-as 17 set logical-systems A protocols bgp group external-peers neighbor 2001:db8:0:1:2a0:a502:0:19da set logical-systems A routing-options router-id 172.16.1.1 set logical-systems A routing-options autonomous-system 22
设备 B
set logical-systems B interfaces lt-0/1/0 unit 6 description to-E set logical-systems B interfaces lt-0/1/0 unit 6 encapsulation frame-relay set logical-systems B interfaces lt-0/1/0 unit 6 dlci 6 set logical-systems B interfaces lt-0/1/0 unit 6 peer-unit 5 set logical-systems B interfaces lt-0/1/0 unit 6 family inet6 address 2001:db8:0:2::/64 eui-64 set logical-systems B interfaces lo0 unit 2 family inet6 address 2001:db8::2/128 set logical-systems B protocols bgp group external-peers type external set logical-systems B protocols bgp group external-peers peer-as 17 set logical-systems B protocols bgp group external-peers neighbor 2001:db8:0:2:2a0:a502:0:5da set logical-systems B routing-options router-id 172.16.2.2 set logical-systems B routing-options autonomous-system 22
设备 C
set logical-systems C interfaces lt-0/1/0 unit 10 description to-E set logical-systems C interfaces lt-0/1/0 unit 10 encapsulation frame-relay set logical-systems C interfaces lt-0/1/0 unit 10 dlci 10 set logical-systems C interfaces lt-0/1/0 unit 10 peer-unit 9 set logical-systems C interfaces lt-0/1/0 unit 10 family inet6 address 2001:db8:0:3::/64 eui-64 set logical-systems C interfaces lo0 unit 3 family inet6 address 2001:db8::3/128 set logical-systems C protocols bgp group external-peers type external set logical-systems C protocols bgp group external-peers peer-as 17 set logical-systems C protocols bgp group external-peers neighbor 2001:db8:0:3:2a0:a502:0:9da set logical-systems C routing-options router-id 172.16.3.3 set logical-systems C routing-options autonomous-system 22
设备 D
set logical-systems D interfaces lt-0/1/0 unit 7 description to-E set logical-systems D interfaces lt-0/1/0 unit 7 encapsulation frame-relay set logical-systems D interfaces lt-0/1/0 unit 7 dlci 7 set logical-systems D interfaces lt-0/1/0 unit 7 peer-unit 21 set logical-systems D interfaces lt-0/1/0 unit 7 family inet6 address 2001:db8:0:4::/64 eui-64 set logical-systems D interfaces lo0 unit 4 family inet6 address 2001:db8::4/128 set logical-systems D protocols bgp group external-peers type external set logical-systems D protocols bgp group external-peers peer-as 17 set logical-systems D protocols bgp group external-peers neighbor 2001:db8:0:4:2a0:a502:0:15da set logical-systems D routing-options router-id 172.16.4.4 set logical-systems D routing-options autonomous-system 79
设备 E
set logical-systems E interfaces lt-0/1/0 unit 5 description to-B set logical-systems E interfaces lt-0/1/0 unit 5 encapsulation frame-relay set logical-systems E interfaces lt-0/1/0 unit 5 dlci 6 set logical-systems E interfaces lt-0/1/0 unit 5 peer-unit 6 set logical-systems E interfaces lt-0/1/0 unit 5 family inet6 address 2001:db8:0:2::/64 eui-64 set logical-systems E interfaces lt-0/1/0 unit 9 description to-C set logical-systems E interfaces lt-0/1/0 unit 9 encapsulation frame-relay set logical-systems E interfaces lt-0/1/0 unit 9 dlci 10 set logical-systems E interfaces lt-0/1/0 unit 9 peer-unit 10 set logical-systems E interfaces lt-0/1/0 unit 9 family inet6 address 2001:db8:0:3::/64 eui-64 set logical-systems E interfaces lt-0/1/0 unit 21 description to-D set logical-systems E interfaces lt-0/1/0 unit 21 encapsulation frame-relay set logical-systems E interfaces lt-0/1/0 unit 21 dlci 7 set logical-systems E interfaces lt-0/1/0 unit 21 peer-unit 7 set logical-systems E interfaces lt-0/1/0 unit 21 family inet6 address 2001:db8:0:4::/64 eui-64 set logical-systems E interfaces lt-0/1/0 unit 25 description to-A set logical-systems E interfaces lt-0/1/0 unit 25 encapsulation frame-relay set logical-systems E interfaces lt-0/1/0 unit 25 dlci 1 set logical-systems E interfaces lt-0/1/0 unit 25 peer-unit 1 set logical-systems E interfaces lt-0/1/0 unit 25 family inet6 address 2001:db8:0:1::/64 eui-64 set logical-systems E interfaces lo0 unit 5 family inet6 address 2001:db8::5/128 set logical-systems E protocols bgp group external-peers type external set logical-systems E protocols bgp group external-peers peer-as 22 set logical-systems E protocols bgp group external-peers neighbor 2001:db8:0:1:2a0:a502:0:1da set logical-systems E protocols bgp group external-peers neighbor 2001:db8:0:2:2a0:a502:0:6da set logical-systems E protocols bgp group external-peers neighbor 2001:db8:0:3:2a0:a502:0:ada set logical-systems E protocols bgp group external-peers neighbor 2001:db8:0:4:2a0:a502:0:7da peer-as 79 set logical-systems E routing-options router-id 172.16.5.5 set logical-systems E routing-options autonomous-system 17
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话,
show interfaces terse
运行 命令以验证物理路由器是否具有逻辑隧道 (lt) 接口。user@R1> show interfaces terse Interface Admin Link Proto Local Remote ... lt-0/1/0 up up ...
在逻辑系统 A 上,配置接口封装、对等单元编号和 DLCI 以到达逻辑系统 E。
user@R1> set cli logical-system A Logical system: A [edit] user@R1:A> edit Entering configuration mode [edit] user@R1:A# edit interfaces [edit interfaces] user@R1:A# set lt-0/1/0 unit 1 encapsulation frame-relay user@R1:A# set lt-0/1/0 unit 1 dlci 1 user@R1:A# set lt-0/1/0 unit 1 peer-unit 25
在逻辑系统 A 上,配置到 Peer E 的链路的网络地址并配置环路接口。
[edit interfaces] user@R1:A# set lt-0/1/0 unit 1 description to-E user@R1:A# set lt-0/1/0 unit 1 family inet6 address 2001:db8:0:1::/64 eui-64 user@R1:A# set lo0 unit 1 family inet6 address 2001:db8::1/128
在逻辑系统 E 上,配置接口封装、对等单元编号和 DLCI 以到达逻辑系统 A。
user@R1> set cli logical-system E Logical system: E [edit] user@R1:E> edit Entering configuration mode [edit] user@R1:E# edit interfaces [edit interfaces] user@R1:E# set lt-0/1/0 unit 25 encapsulation frame-relay user@R1:E# set lt-0/1/0 unit 25 dlci 1 user@R1:E# set lt-0/1/0 unit 25 peer-unit 1
在逻辑系统 E 上,配置到 Peer A 的链路的网络地址并配置环路接口。
[edit interfaces] user@R1:E# set lt-0/1/0 unit 25 description to-A user@R1:E# set lt-0/1/0 unit 25 family inet6 address 2001:db8:0:1::/64 eui-64 user@R1:E# set lo0 unit 5 family inet6 address 2001:db8::5/128
show interfaces terse
运行 命令以查看由 EUI-64 生成的 IPv6 地址。此示例中使用的 2001 地址在 BGP
neighbor
语句中。注:fe80 地址是链路本地地址,此示例中未使用。
user@R1:A> show interfaces terse Interface Admin Link Proto Local Remote Logical system: A betsy@tp8:A> show interfaces terse Interface Admin Link Proto Local Remote lt-0/1/0 lt-0/1/0.1 up up inet6 2001:db8:0:1:2a0:a502:0:1da/64 fe80::2a0:a502:0:1da/64 lo0 lo0.1 up up inet6 2001:db8::1 fe80::2a0:a50f:fc56:1da
user@R1:E> show interfaces terse Interface Admin Link Proto Local Remote lt-0/1/0 lt-0/1/0.25 up up inet6 2001:db8:0:1:2a0:a502:0:19da/64 fe80::2a0:a502:0:19da/64 lo0 lo0.5 up up inet6 2001:db8::5 fe80::2a0:a50f:fc56:1da
在其他逻辑系统上重复接口配置。
配置外部 BGP 会话
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话,
在逻辑系统 A 上,创建 BGP 组并添加外部邻接方地址。
[edit protocols bgp group external-peers] user@R1:A# set neighbor 2001:db8:0:1:2a0:a502:0:19da
在逻辑系统 E 上,创建 BGP 组并添加外部邻接方地址。
[edit protocols bgp group external-peers] user@R1:E# set neighbor 2001:db8:0:1:2a0:a502:0:1da
在逻辑系统 A 上,指定外部 AS 的自治系统 (AS) 编号。
[edit protocols bgp group external-peers] user@R1:A# set peer-as 17
在逻辑系统 E 上,指定外部 AS 的自治系统 (AS) 编号。
[edit protocols bgp group external-peers] user@R1:E# set peer-as 22
在逻辑系统 A 上,将对等类型设置为 EBGP。
[edit protocols bgp group external-peers] user@R1:A# set type external
在逻辑系统 E 上,将对等类型设置为 EBGP。
[edit protocols bgp group external-peers] user@R1:E# set type external
在逻辑系统 A 上,设置自治系统 (AS) 编号和路由器 ID。
[edit routing-options] user@R1:A# set router-id 172.16.1.1 user@R1:A# set autonomous-system 22
在逻辑系统 E 上,设置 AS 编号和路由器 ID。
[edit routing-options] user@R1:E# set router-id 172.16.5.5 user@R1:E# set autonomous-system 17
为对等方 A、B、C 和 D 重复这些步骤。
结果
在配置模式下,输入 show logical-systems
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
[edit]
user@R1# show logical-systems
A {
interfaces {
lt-0/1/0 {
unit 1 {
description to-E;
encapsulation frame-relay;
dlci 1;
peer-unit 25;
family inet6 {
address 2001:db8:0:1::/64 {
eui-64;
}
}
}
}
lo0 {
unit 1 {
family inet6 {
address 2001:db8::1/128;
}
}
}
}
protocols {
bgp {
group external-peers {
type external;
peer-as 17;
neighbor 2001:db8:0:1:2a0:a502:0:19da;
}
}
routing-options {
router-id 172.16.1.1;
autonomous-system 22;
}
}
B {
interfaces {
lt-0/1/0 {
unit 6 {
description to-E;
encapsulation frame-relay;
dlci 6;
peer-unit 5;
family inet6 {
address 2001:db8:0:2::/64 {
eui-64;
}
}
}
}
lo0 {
unit 2 {
family inet6 {
address 2001:db8::2/128;
}
}
}
}
protocols {
bgp {
group external-peers {
type external;
peer-as 17;
neighbor 2001:db8:0:2:2a0:a502:0:5da;
}
}
routing-options {
router-id 172.16.2.2;
autonomous-system 22;
}
}
C {
interfaces {
lt-0/1/0 {
unit 10 {
description to-E;
encapsulation frame-relay;
dlci 10;
peer-unit 9;
family inet6 {
address 2001:db8:0:3::/64 {
eui-64;
}
}
}
}
lo0 {
unit 3 {
family inet6 {
address 2001:db8::3/128;
}
}
}
}
protocols {
bgp {
group external-peers {
type external;
peer-as 17;
neighbor 2001:db8:0:3:2a0:a502:0:9da;
}
}
}
routing-options {
router-id 172.16.3.3;
autonomous-system 22;
}
}
D {
interfaces {
lt-0/1/0 {
unit 7 {
description to-E;
encapsulation frame-relay;
dlci 7;
peer-unit 21;
family inet6 {
address 2001:db8:0:4::/64 {
eui-64;
}
}
}
}
lo0 {
unit 4 {
family inet6 {
address 2001:db8::4/128;
}
}
}
}
protocols {
bgp {
group external-peers {
type external;
peer-as 17;
neighbor 2001:db8:0:4:2a0:a502:0:15da;
}
}
routing-options {
router-id 172.16.4.4;
autonomous-system 79;
}
}
E {
interfaces {
lt-0/1/0 {
unit 5 {
description to-B;
encapsulation frame-relay;
dlci 6;
peer-unit 6;
family inet6 {
address 2001:db8:0:2::/64 {
eui-64;
}
}
}
unit 9 {
description to-C;
encapsulation frame-relay;
dlci 10;
peer-unit 10;
family inet6 {
address 2001:db8:0:3::/64 {
eui-64;
}
}
}
unit 21 {
description to-D;
encapsulation frame-relay;
dlci 7;
peer-unit 7;
family inet6 {
address 2001:db8:0:4::/64 {
eui-64;
}
}
}
unit 25 {
description to-A;
encapsulation frame-relay;
dlci 1;
peer-unit 1;
family inet6 {
address 2001:db8:0:1::/64 {
eui-64;
}
}
}
}
lo0 {
unit 5 {
family inet6 {
address 2001:db8::5/128;
}
}
}
}
protocols {
bgp {
group external-peers {
type external;
peer-as 22;
neighbor 2001:db8:0:1:2a0:a502:0:1da;
neighbor 2001:db8:0:2:2a0:a502:0:6da;
neighbor 2001:db8:0:3:2a0:a502:0:ada;
neighbor 2001:db8:0:4:2a0:a502:0:7da {
peer-as 79;
}
}
}
}
routing-options {
router-id 172.16.5.5;
autonomous-system 17;
}
}
如果完成设备配置,请在配置模式下输入 commit 。
验证
确认配置工作正常。
验证 BGP 邻接方
目的
验证 BGP 是否在配置的接口上运行,以及每个邻接方地址的 BGP 会话是否处于活动状态。
行动
在操作模式下 show bgp neighbor
,运行 命令。
user@R1:E> show bgp neighbor Peer: 2001:db8:0:1:2a0:a502:0:1da+54987 AS 22 Local: 2001:db8:0:1:2a0:a502:0:19da+179 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: Open Message Error Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Error: 'Open Message Error' Sent: 20 Recv: 0 Peer ID: 172.16.1.1 Local ID: 172.16.5.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 BFD: disabled, down Local Interface: lt-0/1/0.25 NLRI for restart configured on peer: inet6-unicast NLRI advertised by peer: inet6-unicast NLRI for this session: inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality NLRI that restart is negotiated for: inet6-unicast NLRI of received end-of-rib markers: inet6-unicast NLRI of all end-of-rib markers sent: inet6-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet6.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 7 Sent 18 Checked 81 Input messages: Total 1611 Updates 1 Refreshes 0 Octets 30660 Output messages: Total 1594 Updates 0 Refreshes 0 Octets 30356 Output Queue[0]: 0 Peer: 2001:db8:0:2:2a0:a502:0:6da+179 AS 22 Local: 2001:db8:0:2:2a0:a502:0:5da+55502 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: Open Message Error Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Error: 'Open Message Error' Sent: 26 Recv: 0 Peer ID: 172.16.2.2 Local ID: 172.16.5.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 2 BFD: disabled, down Local Interface: lt-0/1/0.5 NLRI for restart configured on peer: inet6-unicast NLRI advertised by peer: inet6-unicast NLRI for this session: inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality NLRI that restart is negotiated for: inet6-unicast NLRI of received end-of-rib markers: inet6-unicast NLRI of all end-of-rib markers sent: inet6-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet6.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 15 Sent 8 Checked 8 Input messages: Total 1610 Updates 1 Refreshes 0 Octets 30601 Output messages: Total 1645 Updates 0 Refreshes 0 Octets 32417 Output Queue[0]: 0 Peer: 2001:db8:0:3:2a0:a502:0:ada+55983 AS 22 Local: 2001:db8:0:3:2a0:a502:0:9da+179 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 172.16.3.3 Local ID: 172.16.5.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 3 BFD: disabled, down Local Interface: lt-0/1/0.9 NLRI for restart configured on peer: inet6-unicast NLRI advertised by peer: inet6-unicast NLRI for this session: inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality NLRI that restart is negotiated for: inet6-unicast NLRI of received end-of-rib markers: inet6-unicast NLRI of all end-of-rib markers sent: inet6-unicast Peer supports 4 byte AS extension (peer-as 22) Peer does not support Addpath Table inet6.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 21 Sent 21 Checked 67 Input messages: Total 1610 Updates 1 Refreshes 0 Octets 30641 Output messages: Total 1587 Updates 0 Refreshes 0 Octets 30223 Output Queue[0]: 0 Peer: 2001:db8:0:4:2a0:a502:0:7da+49255 AS 79 Local: 2001:db8:0:4:2a0:a502:0:15da+179 AS 17 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 172.16.4.4 Local ID: 172.16.5.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 1 BFD: disabled, down Local Interface: lt-0/1/0.21 NLRI for restart configured on peer: inet6-unicast NLRI advertised by peer: inet6-unicast NLRI for this session: inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality NLRI that restart is negotiated for: inet6-unicast NLRI of received end-of-rib markers: inet6-unicast NLRI of all end-of-rib markers sent: inet6-unicast Peer supports 4 byte AS extension (peer-as 79) Peer does not support Addpath Table inet6.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 0 Accepted prefixes: 0 Suppressed due to damping: 0 Advertised prefixes: 0 Last traffic (seconds): Received 6 Sent 17 Checked 25 Input messages: Total 1615 Updates 1 Refreshes 0 Octets 30736 Output messages: Total 1593 Updates 0 Refreshes 0 Octets 30337 Output Queue[0]: 0
意义
邻接方之间正在交换 IPv6 单播网络层可访问性信息 (NLRI)。
验证 BGP 组
目的
验证 BGP 组是否配置正确。
行动
在操作模式下 show bgp group
,运行 命令。
user@R1:E> show bgp group Group Type: External Local AS: 17 Name: external-peers Index: 0 Flags: <> Holdtime: 0 Total peers: 4 Established: 4 2001:db8:0:1:2a0:a502:0:1da+54987 2001:db8:0:2:2a0:a502:0:6da+179 2001:db8:0:3:2a0:a502:0:ada+55983 2001:db8:0:4:2a0:a502:0:7da+49255 inet6.0: 0/0/0/0 Groups: 1 Peers: 4 External: 4 Internal: 0 Down peers: 0 Flaps: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet6.0 0 0 0 0 0 0 inet6.2 0 0 0 0 0 0
意义
组类型为外部,组有四个对等方。
验证 BGP 摘要信息
目的
验证是否已建立 BGP 对等关系。
行动
在操作模式下 show bgp summary
,运行 命令。
user@R1:E> show bgp summary Groups: 1 Peers: 4 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet6.0 0 0 0 0 0 0 inet6.2 0 0 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 2001:db8:0:1:2a0:a502:0:1da 22 1617 1600 0 0 12:07:00 Establ inet6.0: 0/0/0/0 2001:db8:0:2:2a0:a502:0:6da 22 1616 1651 0 0 12:06:56 Establ inet6.0: 0/0/0/0 2001:db8:0:3:2a0:a502:0:ada 22 1617 1594 0 0 12:04:32 Establ inet6.0: 0/0/0/0 2001:db8:0:4:2a0:a502:0:7da 79 1621 1599 0 0 12:07:00 Establ inet6.0: 0/0/0/0
意义
Down 对等方:0 输出显示 BGP 对等方处于既定状态。
检查路由表
目的
验证 inet6.0 路由表是否已填充本地和直接路由。
行动
在操作模式下 show route
,运行 命令。
user@R1:E> show route inet6.0: 15 destinations, 18 routes (15 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 2001:db8::5/128 *[Direct/0] 12:41:18 > via lo0.5 2001:db8:0:1::/64 *[Direct/0] 14:40:01 > via lt-0/1/0.25 2001:db8:0:1:2a0:a502:0:19da/128 *[Local/0] 14:40:01 Local via lt-0/1/0.25 2001:db8:0:2::/64 *[Direct/0] 14:40:02 > via lt-0/1/0.5 2001:db8:0:2:2a0:a502:0:5da/128 *[Local/0] 14:40:02 Local via lt-0/1/0.5 2001:db8:0:3::/64 *[Direct/0] 14:40:02 > via lt-0/1/0.9 2001:db8:0:3:2a0:a502:0:9da/128 *[Local/0] 14:40:02 Local via lt-0/1/0.9 2001:db8:0:4::/64 *[Direct/0] 14:40:01 > via lt-0/1/0.21 2001:db8:0:4:2a0:a502:0:15da/128 *[Local/0] 14:40:01 Local via lt-0/1/0.21 fe80::/64 *[Direct/0] 14:40:02 > via lt-0/1/0.5 [Direct/0] 14:40:02 > via lt-0/1/0.9 [Direct/0] 14:40:01 > via lt-0/1/0.21 [Direct/0] 14:40:01 > via lt-0/1/0.25 fe80::2a0:a502:0:5da/128 *[Local/0] 14:40:02 Local via lt-0/1/0.5 fe80::2a0:a502:0:9da/128 *[Local/0] 14:40:02 Local via lt-0/1/0.9 fe80::2a0:a502:0:15da/128 *[Local/0] 14:40:01 Local via lt-0/1/0.21 fe80::2a0:a502:0:19da/128 *[Local/0] 14:40:01 Local via lt-0/1/0.25 fe80::2a0:a50f:fc56:1da/128 *[Direct/0] 12:41:18 > via lo0.5
意义
inet6.0 路由表包含本地和直接路由。要将路由表与其他类型的路由一起填充,必须配置路由策略。
了解内部 BGP 对等会话
当两个支持 BGP 的设备处于相同的自治系统 (AS) 中时,BGP 会话称为 内部 BGP 会话或 IBGP 会话。BGP 在 IBGP 和外部 BGP (EBGP) 会话上使用相同的消息类型,但是何时发送每个消息以及如何解释每个消息的规则略有不同。因此,有些人将 IBGP 和 EBGP 称为两个单独的协议。

在 图 4中,Device Jackson、Device Memphis 和 Device Biloxi 之间有 IBGP 对等会话。同样,设备迈阿密和设备亚特兰大有IBGP对等会话之间。
IBGP 的目的是提供一种可在整个网络中转发 EBGP 路由通告的方法。从理论上讲,要完成这项任务,您可以将所有 EBGP 路由重新分配为内部网关协议 (IGP),例如 OSPF 或 IS-IS。但是,由于互联网中存在大量 EBGP 路由,并且 IGP 的运维方式,因此在生产环境中不建议这样做。简而言之,IGP 发生混乱或崩溃的路由很多。
通常,环路接口 (lo0) 用于在 IBGP 对等方之间建立连接。只要设备在运行,回传接口就始终正常运行。如果有通向环路地址的路由,则 IBGP 对等会话将保持正常运行。如果改为使用物理接口地址,并且该接口向上和向下,则 IBGP 对等会话也会起起落落。因此,如果设备具有链路冗余,环路接口可在物理接口或链路中断时提供容错。
虽然 IBGP 邻接方不需要直接连接,但它们确实需要完全网状化。在这种情况下,全网状表示每个设备都通过邻接方对等关系在逻辑上连接到所有其他设备。语 neighbor
句创建网状。由于 IBGP 的全网状要求,您必须在 AS 中的所有 IBGP 设备之间配置单独的对等会话。全网状不必是物理链路。相反,每个路由设备上的配置都必须创建对等会话的全网状(使用多个 neighbor
语句)。
如果配置了联合体或路由反射,则放弃对全网状结构的要求。
要了解全网状要求,请考虑不能将 IBGP 获知的路由重新修改为其他 IBGP 对等方。防止重新调整 IBGP 路由并要求全网状结构的原因是避免 AS 内的路由环路。AS 路径属性是 BGP 路由设备避免环路的方法。只有在从 EBGP 对等方接收路由时,才会检查本地 AS 编号的路径信息。由于属性仅跨 AS 边界修改,因此此系统运行良好。但是,仅跨 AS 边界修改属性的事实会在 AS 内部出现问题。例如,假设路由设备 A、B 和 C 都在同一 AS 中。设备 A 从 EBGP 对等方接收路由,并将路由发送至设备 B,设备 B 将其安装为活动路由。然后,路由会发送至设备 C,后者会在本地安装并将其发送回设备 A。如果设备 A 安装路由,则在 AS 内形成环路。由于 AS 路径属性不会在这些播发期间修改,路由设备无法检测到环路。因此,BGP 协议设计人员决定,永远不会形成路由环路的唯一保证是防止 IBGP 对等方在 AS 中播发 IBGP 学习的路由。为了实现路由可达性,IBGP 对等方完全网状化。
IBGP 支持多用途连接,因此 IBGP 邻接方可位于 AS 内的任何位置,并且通常不共享链路。递归路由查找可将环路对等地址解析到下一跳跃的 IP 转发。查找服务由静态路由或 IGP(如 OSPF 或 BGP 路由)提供。
另请参阅
示例:配置内部 BGP 对等会话
此示例说明如何配置内部 BGP 对等会话。
要求
配置此示例之前,无需设备初始化以外的特殊配置。
概述
在此示例中,您可配置内部 BGP (IBGP) 对等会话。环路接口 (lo0) 用于在 IBGP 对等方之间建立连接。只要设备在运行,回传接口就始终正常运行。如果有通向环路地址的路由,则 IBGP 对等会话将保持正常运行。如果改为使用物理接口地址,并且该接口向上和向下,则 IBGP 对等会话也会起起落落。因此,如果设备具有链路冗余,则环路接口可在物理接口或其中一个链路断开时提供容错。
当设备与远程设备的环路接口地址对等时,本地设备会期望来自(由)远程设备的环路接口地址发出的 BGP 更新消息。该 local-address
语句允许您指定 BGP 更新消息中的源信息。如果省略该 local-address
语句,则 BGP 更新消息的预期来源基于设备的源地址选择规则,通常导致出口接口地址为更新消息的预期来源。发生这种情况时,将未建立对等会话,因为预期源地址(对等方的出口接口)与实际源(对等方的环路接口)之间存在不匹配。要确保预期源地址与实际源地址匹配,请在语句中 local-address
指定环路接口地址。
由于 IBGP 支持多用途连接,因此 IBGP 邻接方可位于自治系统 (AS) 内的任何位置,并且通常不共享链路。递归路由查找可将环路对等方地址解析到下一跳跃的 IP 转发。在此示例中,此服务由 OSPF 提供。尽管不需要直接连接内部网关协议 (IGP) 邻接方,但它们确实需要完全网状化。在这种情况下,全网状表示每个设备都通过邻接方对等关系在逻辑上连接到所有其他设备。语 neighbor
句创建网状。
如果配置了联合体或路由反射,则放弃对全网状结构的要求。
建立 BGP 对等方后,本地路由不会由 BGP 对等方自动通告。在每个支持 BGP 的设备上,都需要策略配置将本地、静态或 IGP 学习的路由导出到 BGP 路由信息库 (RIB),然后将其播发为 BGP 路由给其他对等方。默认情况下,BGP 的广告策略不会向对等方播发任何非 BGP 路由(如本地路由)。
在示例网络中,AS 17 中的设备在组 internal-peers中完全网状化。这些设备的回传地址为 192.168.6.5、192.163.6.4 和 192.168.40.4。
图 5 显示了具有内部对等会话的典型网络。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,移除任何换行符,更改与网络配置匹配所需的任何详细信息,然后将命令复制粘贴到层次结构级别的 [edit]
CLI 中。
设备 A
set interfaces ge-0/1/0 unit 1 description to-B set interfaces ge-0/1/0 unit 1 family inet address 10.10.10.1/30 set interfaces lo0 unit 1 family inet address 192.168.6.5/32 set protocols bgp group internal-peers type internal set protocols bgp group internal-peers description “connections to B and C” set protocols bgp group internal-peers local-address 192.168.6.5 set protocols bgp group internal-peers export send-direct set protocols bgp group internal-peers neighbor 192.163.6.4 set protocols bgp group internal-peers neighbor 192.168.40.4 set protocols ospf area 0.0.0.0 interface lo0.1 passive set protocols ospf area 0.0.0.0 interface ge-0/1/0.1 set policy-options policy-statement send-direct term 2 from protocol direct set policy-options policy-statement send-direct term 2 then accept set routing-options router-id 192.168.6.5 set routing-options autonomous-system 17
设备 B
set interfaces ge-0/1/0 unit 2 description to-A set interfaces ge-0/1/0 unit 2 family inet address 10.10.10.2/30 set interfaces ge-0/1/1 unit 5 description to-C set interfaces ge-0/1/1 unit 5 family inet address 10.10.10.5/30 set interfaces lo0 unit 2 family inet address 192.163.6.4/32 set protocols bgp group internal-peers type internal set protocols bgp group internal-peers description “connections to A and C” set protocols bgp group internal-peers local-address 192.163.6.4 set protocols bgp group internal-peers export send-direct set protocols bgp group internal-peers neighbor 192.168.40.4 set protocols bgp group internal-peers neighbor 192.168.6.5 set protocols ospf area 0.0.0.0 interface lo0.2 passive set protocols ospf area 0.0.0.0 interface ge-0/1/0.2 set protocols ospf area 0.0.0.0 interface ge-0/1/1.5 set policy-options policy-statement send-direct term 2 from protocol direct set policy-options policy-statement send-direct term 2 then accept set routing-options router-id 192.163.6.4 set routing-options autonomous-system 17
设备 C
set interfaces ge-0/1/0 unit 6 description to-B set interfaces ge-0/1/0 unit 6 family inet address 10.10.10.6/30 set interfaces lo0 unit 3 family inet address 192.168.40.4/32 set protocols bgp group internal-peers type internal set protocols bgp group internal-peers description “connections to A and B” set protocols bgp group internal-peers local-address 192.168.40.4 set protocols bgp group internal-peers export send-direct set protocols bgp group internal-peers neighbor 192.163.6.4 set protocols bgp group internal-peers neighbor 192.168.6.5 set protocols ospf area 0.0.0.0 interface lo0.3 passive set protocols ospf area 0.0.0.0 interface ge-0/1/0.6 set policy-options policy-statement send-direct term 2 from protocol direct set policy-options policy-statement send-direct term 2 then accept set routing-options router-id 192.168.40.4 set routing-options autonomous-system 17
配置设备 A
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 Junos OS CLI 用户指南中的配置模式下使用 CLI 编辑器。
要在设备 A 上配置内部 BGP 对等会话:
配置接口。
[edit interfaces ge-0/1/0 unit 1] user@A# set description to-B user@A# set family inet address 10.10.10.1/30 [edit interfaces] user@A# set lo0 unit 1 family inet address 192.168.6.5/32
配置 BGP。
neighbor
即使设备 A 未直接连接到设备 C,也包括对设备 B 和设备 C 的语句。[edit protocols bgp group internal-peers] user@A# set type internal user@A# set description “connections to B and C” user@A# set local-address 192.168.6.5 user@A# set export send-direct user@A# set neighbor 192.163.6.4 user@A# set neighbor 192.168.40.4
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@A# set interface lo0.1 passive user@A# set interface ge-0/1/0.1
配置接受直接路由的策略。
在这种情况下,其他有用的选项可能是接受通过 OSPF 或本地路由学习的路由。
[edit policy-options policy-statement send-direct term 2] user@A# set from protocol direct user@A# set then accept
配置路由器 ID 和 AS 编号。
[edit routing-options] user@A# set router-id 192.168.6.5 user@A# set autonomous-system 17
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show protocols
和 show routing-options
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@A# show interfaces ge-0/1/0 { unit 1 { description to-B; family inet { address 10.10.10.1/30; } } } lo0 { unit 1 { family inet { address 192.168.6.5/32; } } }
user@A# show policy-options policy-statement send-direct { term 2 { from protocol direct; then accept; } }
user@A# show protocols bgp { group internal-peers { type internal; description “connections to B and C”; local-address 192.168.6.5; export send-direct; neighbor 192.163.6.4; neighbor 192.168.40.4; } } ospf { area 0.0.0.0 { interface lo0.1 { passive; } interface ge-0/1/0.1; } }
user@A# show routing-options router-id 192.168.6.5; autonomous-system 17;
如果完成设备配置,请在配置模式下输入 commit 。
配置设备 B
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 在配置模式下使用 CLI 编辑器。
要在设备 B 上配置内部 BGP 对等会话:
配置接口。
[edit interfaces ge-0/1/0 unit 2] user@B# set description to-A user@B# set family inet address 10.10.10.2/30 [edit interfaces ge-0/1/1] user@B# set unit 5 description to-C user@B# set unit 5 family inet address 10.10.10.5/30 [edit interfaces] user@B# set lo0 unit 2 family inet address 192.163.6.4/32
配置 BGP。
neighbor
即使设备 A 未直接连接到设备 C,也包括对设备 B 和设备 C 的语句。[edit protocols bgp group internal-peers] user@B# set type internal user@B# set description “connections to A and C” user@B# set local-address 192.163.6.4 user@B# set export send-direct user@B# set neighbor 192.168.40.4 user@B# set neighbor 192.168.6.5
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@B# set interface lo0.2 passive user@B# set interface ge-0/1/0.2 user@B# set interface ge-0/1/1.5
配置接受直接路由的策略。
在这种情况下,其他有用的选项可能是接受通过 OSPF 或本地路由学习的路由。
[edit policy-options policy-statement send-direct term 2] user@B# set from protocol direct user@B# set then accept
配置路由器 ID 和 AS 编号。
[edit routing-options] user@B# set router-id 192.163.6.4 user@B# set autonomous-system 17
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show protocols
和 show routing-options
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@B# show interfaces ge-0/1/0 { unit 2 { description to-A; family inet { address 10.10.10.2/30; } } } ge-0/1/1 { unit 5 { description to-C; family inet { address 10.10.10.5/30; } } } lo0 { unit 2 { family inet { address 192.163.6.4/32; } } }
user@B# show policy-options policy-statement send-direct { term 2 { from protocol direct; then accept; } }
user@B# show protocols bgp { group internal-peers { type internal; description “connections to A and C”; local-address 192.163.6.4; export send-direct; neighbor 192.168.40.4; neighbor 192.168.6.5; } } ospf { area 0.0.0.0 { interface lo0.2 { passive; } interface ge-0/1/0.2; interface ge-0/1/1.5; } }
user@B# show routing-options router-id 192.163.6.4; autonomous-system 17;
如果完成设备配置,请在配置模式下输入 commit 。
配置设备 C
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 Junos OS CLI 用户指南中的配置模式下使用 CLI 编辑器。
要在设备 C 上配置内部 BGP 对等会话:
配置接口。
[edit interfaces ge-0/1/0 unit 6] user@C# set description to-B user@C# set family inet address 10.10.10.6/30 [edit interfaces] user@C# set lo0 unit 3 family inet address 192.168.40.4/32
配置 BGP。
neighbor
即使设备 A 未直接连接到设备 C,也包括对设备 B 和设备 C 的语句。[edit protocols bgp group internal-peers] user@C# set type internal user@C# set description “connections to A and B” user@C# set local-address 192.168.40.4 user@C# set export send-direct user@C# set neighbor 192.163.6.4 user@C# set neighbor 192.168.6.5
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@C# set interface lo0.3 passive user@C# set interface ge-0/1/0.6
配置接受直接路由的策略。
在这种情况下,其他有用的选项可能是接受通过 OSPF 或本地路由学习的路由。
[edit policy-options policy-statement send-direct term 2] user@C# set from protocol direct user@C# set then accept
配置路由器 ID 和 AS 编号。
[edit routing-options] user@C# set router-id 192.168.40.4 user@C# set autonomous-system 17
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show protocols
和 show routing-options
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@C# show interfaces ge-0/1/0 { unit 6 { description to-B; family inet { address 10.10.10.6/30; } } } lo0 { unit 3 { family inet { address 192.168.40.4/32; } } }
user@C# show policy-options policy-statement send-direct { term 2 { from protocol direct; then accept; } }
user@C# show protocols bgp { group internal-peers { type internal; description “connections to A and B”; local-address 192.168.40.4; export send-direct; neighbor 192.163.6.4; neighbor 192.168.6.5; } } ospf { area 0.0.0.0 { interface lo0.3 { passive; } interface ge-0/1/0.6; } }
user@C# show routing-options router-id 192.168.40.4; autonomous-system 17;
如果完成设备配置,请在配置模式下输入 commit 。
验证
确认配置工作正常。
验证 BGP 邻接方
目的
验证 BGP 是否在配置的接口上运行,以及每个邻接方地址的 BGP 会话是否处于活动状态。
行动
在操作模式下,输入 show bgp neighbor
命令。
user@A> show bgp neighbor Peer: 192.163.6.4+179 AS 17 Local: 192.168.6.5+58852 AS 17 Type: Internal State: Established Flags: Sync Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ send-direct ] Options: Preference LocalAddress Refresh Local Address: 192.168.6.5 Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 192.163.6.4 Local ID: 192.168.6.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 BFD: disabled, down NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 17) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 3 Accepted prefixes: 3 Suppressed due to damping: 0 Advertised prefixes: 2 Last traffic (seconds): Received 25 Sent 19 Checked 67 Input messages: Total 2420 Updates 4 Refreshes 0 Octets 46055 Output messages: Total 2411 Updates 2 Refreshes 0 Octets 45921 Output Queue[0]: 0 Peer: 192.168.40.4+179 AS 17 Local: 192.168.6.5+56466 AS 17 Type: Internal State: Established Flags: Sync Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ send-direct ] Options: Preference LocalAddress Refresh Local Address: 192.168.6.5 Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 192.168.40.4 Local ID: 192.168.6.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 1 BFD: disabled, down NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 17) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 2 Accepted prefixes: 2 Suppressed due to damping: 0 Advertised prefixes: 2 Last traffic (seconds): Received 7 Sent 21 Checked 24 Input messages: Total 2412 Updates 2 Refreshes 0 Octets 45867 Output messages: Total 2409 Updates 2 Refreshes 0 Octets 45883 Output Queue[0]: 0
验证 BGP 组
目的
验证 BGP 组是否配置正确。
行动
在操作模式下,输入 show bgp group
命令。
user@A> show bgp group Group Type: Internal AS: 17 Local AS: 17 Name: internal-peers Index: 0 Flags: <Export Eval> Export: [ send-direct ] Holdtime: 0 Total peers: 2 Established: 2 192.163.6.4+179 192.168.40.4+179 inet.0: 0/5/5/0 Groups: 1 Peers: 2 External: 0 Internal: 2 Down peers: 0 Flaps: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 5 0 0 0 0 0
验证 BGP 摘要信息
目的
验证 BGP 配置是否正确。
行动
在操作模式下,输入 show bgp summary
命令。
user@A> show bgp summary Groups: 1 Peers: 2 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 5 0 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 192.163.6.4 17 2441 2432 0 0 18:18:52 0/3/3/0 0/0/0/0 192.168.40.4 17 2432 2430 0 0 18:18:48 0/2/2/0 0/0/0/0
验证是否已在路由表中安装 BGP 路由
目的
验证导出策略配置是否导致 BGP 路由安装在对等方的路由表中。
行动
在操作模式下,输入 show route protocol bgp
命令。
user@A> show route protocol bgp inet.0: 7 destinations, 12 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 [BGP/170] 07:09:57, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via ge-0/1/0.1 10.10.10.4/30 [BGP/170] 07:09:57, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via ge-0/1/0.1 [BGP/170] 07:07:12, localpref 100, from 192.168.40.4 AS path: I > to 10.10.10.2 via ge-0/1/0.1 192.163.6.4/32 [BGP/170] 07:09:57, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via ge-0/1/0.1 192.168.40.4/32 [BGP/170] 07:07:12, localpref 100, from 192.168.40.4 AS path: I > to 10.10.10.2 via ge-0/1/0.1
示例:在逻辑系统上配置内部 BGP 对等会话
此示例说明如何在逻辑系统上配置内部 BGP 对等会话。
要求
在此示例中,除了设备初始化之外,不需要特殊配置。
概述
在此示例中,您可配置内部 BGP (IBGP) 对等会话。
在示例网络中,AS 17 中的设备在组 internal-peers中完全网状化。这些设备的回传地址为 192.168.6.5、192.163.6.4 和 192.168.40.4。
图 6 显示了具有内部对等会话的典型网络。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,移除任何换行符,更改与网络配置匹配所需的任何详细信息,然后将命令复制粘贴到层次结构级别的 [edit]
CLI 中。
set logical-systems A interfaces lt-0/1/0 unit 1 description to-B set logical-systems A interfaces lt-0/1/0 unit 1 encapsulation ethernet set logical-systems A interfaces lt-0/1/0 unit 1 peer-unit 2 set logical-systems A interfaces lt-0/1/0 unit 1 family inet address 10.10.10.1/30 set logical-systems A interfaces lo0 unit 1 family inet address 192.168.6.5/32 set logical-systems A protocols bgp group internal-peers type internal set logical-systems A protocols bgp group internal-peers local-address 192.168.6.5 set logical-systems A protocols bgp group internal-peers export send-direct set logical-systems A protocols bgp group internal-peers neighbor 192.163.6.4 set logical-systems A protocols bgp group internal-peers neighbor 192.168.40.4 set logical-systems A protocols ospf area 0.0.0.0 interface lo0.1 passive set logical-systems A protocols ospf area 0.0.0.0 interface lt-0/1/0.1 set logical-systems A policy-options policy-statement send-direct term 2 from protocol direct set logical-systems A policy-options policy-statement send-direct term 2 then accept set logical-systems A routing-options router-id 192.168.6.5 set logical-systems A routing-options autonomous-system 17 set logical-systems B interfaces lt-0/1/0 unit 2 description to-A set logical-systems B interfaces lt-0/1/0 unit 2 encapsulation ethernet set logical-systems B interfaces lt-0/1/0 unit 2 peer-unit 1 set logical-systems B interfaces lt-0/1/0 unit 2 family inet address 10.10.10.2/30 set logical-systems B interfaces lt-0/1/0 unit 5 description to-C set logical-systems B interfaces lt-0/1/0 unit 5 encapsulation ethernet set logical-systems B interfaces lt-0/1/0 unit 5 peer-unit 6 set logical-systems B interfaces lt-0/1/0 unit 5 family inet address 10.10.10.5/30 set logical-systems B interfaces lo0 unit 2 family inet address 192.163.6.4/32 set logical-systems B protocols bgp group internal-peers type internal set logical-systems B protocols bgp group internal-peers local-address 192.163.6.4 set logical-systems B protocols bgp group internal-peers export send-direct set logical-systems B protocols bgp group internal-peers neighbor 192.168.40.4 set logical-systems B protocols bgp group internal-peers neighbor 192.168.6.5 set logical-systems B protocols ospf area 0.0.0.0 interface lo0.2 passive set logical-systems B protocols ospf area 0.0.0.0 interface lt-0/1/0.2 set logical-systems B protocols ospf area 0.0.0.0 interface lt-0/1/0.5 set logical-systems B policy-options policy-statement send-direct term 2 from protocol direct set logical-systems B policy-options policy-statement send-direct term 2 then accept set logical-systems B routing-options router-id 192.163.6.4 set logical-systems B routing-options autonomous-system 17 set logical-systems C interfaces lt-0/1/0 unit 6 description to-B set logical-systems C interfaces lt-0/1/0 unit 6 encapsulation ethernet set logical-systems C interfaces lt-0/1/0 unit 6 peer-unit 5 set logical-systems C interfaces lt-0/1/0 unit 6 family inet address 10.10.10.6/30 set logical-systems C interfaces lo0 unit 3 family inet address 192.168.40.4/32 set logical-systems C protocols bgp group internal-peers type internal set logical-systems C protocols bgp group internal-peers local-address 192.168.40.4 set logical-systems C protocols bgp group internal-peers export send-direct set logical-systems C protocols bgp group internal-peers neighbor 192.163.6.4 set logical-systems C protocols bgp group internal-peers neighbor 192.168.6.5 set logical-systems C protocols ospf area 0.0.0.0 interface lo0.3 passive set logical-systems C protocols ospf area 0.0.0.0 interface lt-0/1/0.6 set logical-systems C policy-options policy-statement send-direct term 2 from protocol direct set logical-systems C policy-options policy-statement send-direct term 2 then accept set logical-systems C routing-options router-id 192.168.40.4 set logical-systems C routing-options autonomous-system 17
设备 A
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的配置模式下使用 CLI 编辑器。
要在设备 A 上配置内部 BGP 对等会话:
配置接口。
[edit logical-systems A interfaces lt-0/1/0 unit 1] user@R1# set description to-B user@R1# set encapsulation ethernet user@R1# set peer-unit 2 user@R1# set family inet address 10.10.10.1/30 user@R1# set family inet address 192.168.6.5/32 user@R1# up user@R1# up [edit logical-systems A interfaces] user@R1# set lo0 unit 1 family inet address 192.168.6.5/32 user@R1# exit [edit] user@R1# edit logical-systems B interfaces lt-0/1/0 [edit logical-systems B interfaces lt-0/1/0] user@R1# set unit 2 description to-A user@R1# set unit 2 encapsulation ethernet user@R1# set unit 2 peer-unit 1 user@R1# set unit 2 family inet address 10.10.10.2/30 user@R1# set unit 5 description to-C user@R1# set unit 5 encapsulation ethernet user@R1# set unit 5 peer-unit 6 user@R1# set family inet address 10.10.10.5/30 user@R1# up [edit logical-systems B interfaces] user@R1# set lo0 unit 2 family inet address 192.163.6.4/32 user@R1# exit [edit] user@R1# edit logical-systems C interfaces lt-0/1/0 unit 6 [edit logical-systems C interfaces lt-0/1/0 unit 6] set description to-B set encapsulation ethernet set peer-unit 5 set family inet address 10.10.10.6/30 user@R1# up user@R1# up [edit logical-systems C interfaces] set lo0 unit 3 family inet address 192.168.40.4/32
配置 BGP。
在逻辑系统 A 上
neighbor
,即使逻辑系统 A 未直接连接到设备 C,也包括设备 B 和设备 C 的语句。[edit logical-systems A protocols bgp group internal-peers] user@R1# set type internal user@R1# set local-address 192.168.6.5 user@R1# set export send-direct user@R1# set neighbor 192.163.6.4 user@R1# set neighbor 192.168.40.4 [edit logical-systems B protocols bgp group internal-peers] user@R1# set type internal user@R1# set local-address 192.163.6.4 user@R1# set export send-direct user@R1# set neighbor 192.168.40.4 user@R1# set neighbor 192.168.6.5 [edit logical-systems C protocols bgp group internal-peers] user@R1# set type internal user@R1# set local-address 192.168.40.4 user@R1# set export send-direct user@R1# set neighbor 192.163.6.4 user@R1# set neighbor 192.168.6.5
配置 OSPF。
[edit logical-systems A protocols ospf area 0.0.0.0] user@R1# set interface lo0.1 passive user@R1# set interface lt-0/1/0.1 [edit logical-systems A protocols ospf area 0.0.0.0] user@R1# set interface lo0.2 passive user@R1# set interface lt-0/1/0.2 user@R1# set interface lt-0/1/0.5 [edit logical-systems A protocols ospf area 0.0.0.0] user@R1# set interface lo0.3 passive user@R1# set interface lt-0/1/0.6
配置接受直接路由的策略。
在这种情况下,其他有用的选项可能是接受通过 OSPF 或本地路由学习的路由。
[edit logical-systems A policy-options policy-statement send-direct term 2] user@R1# set from protocol direct user@R1# set then accept [edit logical-systems B policy-options policy-statement send-direct term 2] user@R1# set from protocol direct user@R1# set then accept [edit logical-systems C policy-options policy-statement send-direct term 2] user@R1# set from protocol direct user@R1# set then accept
配置路由器 ID 和自治系统 (AS) 编号。
[edit logical-systems A routing-options] user@R1# set router-id 192.168.6.5 user@R1# set autonomous-system 17 [edit logical-systems B routing-options] user@R1# set router-id 192.163.6.4 user@R1# set autonomous-system 17 [edit logical-systems C routing-options] user@R1# set router-id 192.168.40.4 user@R1# set autonomous-system 17
结果
在配置模式下,输入 show logical-systems
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明以将其更正。
user@R1# show logical-systems A { interfaces { lt-0/1/0 { unit 1 { description to-B; encapsulation ethernet; peer-unit 2; family inet { address 10.10.10.1/30; } } } lo0 { unit 1 { family inet { address 192.168.6.5/32; } } } } protocols { bgp { group internal-peers { type internal; local-address 192.168.6.5; export send-direct; neighbor 192.163.6.4; neighbor 192.168.40.4; } } ospf { area 0.0.0.0 { interface lo0.1 { passive; } interface lt-0/1/0.1; } } } policy-options { policy-statement send-direct { term 2 { from protocol direct; then accept; } } } routing-options { router-id 192.168.6.5; autonomous-system 17; } } B { interfaces { lt-0/1/0 { unit 2 { description to-A; encapsulation ethernet; peer-unit 1; family inet { address 10.10.10.2/30; } } unit 5 { description to-C; encapsulation ethernet; peer-unit 6; family inet { address 10.10.10.5/30; } } } lo0 { unit 2 { family inet { address 192.163.6.4/32; } } } } protocols { bgp { group internal-peers { type internal; local-address 192.163.6.4; export send-direct; neighbor 192.168.40.4; neighbor 192.168.6.5; } } ospf { area 0.0.0.0 { interface lo0.2 { passive; } interface lt-0/1/0.2; interface lt-0/1/0.5; } } } policy-options { policy-statement send-direct { term 2 { from protocol direct; then accept; } } } routing-options { router-id 192.163.6.4; autonomous-system 17; } } C { interfaces { lt-0/1/0 { unit 6 { description to-B; encapsulation ethernet; peer-unit 5; family inet { address 10.10.10.6/30; } } } lo0 { unit 3 { family inet { address 192.168.40.4/32; } } } } protocols { bgp { group internal-peers { type internal; local-address 192.168.40.4; export send-direct; neighbor 192.163.6.4; neighbor 192.168.6.5; } } ospf { area 0.0.0.0 { interface lo0.3 { passive; } interface lt-0/1/0.6; } } } policy-options { policy-statement send-direct { term 2 { from protocol direct; then accept; } } } routing-options { router-id 192.168.40.4; autonomous-system 17; } }
如果完成设备配置,请在配置模式下输入 commit 。
验证
确认配置工作正常。
验证 BGP 邻接方
目的
验证 BGP 是否在配置的接口上运行,以及每个邻接方地址的 BGP 会话是否处于活动状态。
行动
在操作模式下,输入 show bgp neighbor
命令。
user@R1> show bgp neighbor logical-system A Peer: 192.163.6.4+179 AS 17 Local: 192.168.6.5+58852 AS 17 Type: Internal State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ send-direct ] Options: <Preference LocalAddress Refresh> Local Address: 192.168.6.5 Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 192.163.6.4 Local ID: 192.168.6.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 0 BFD: disabled, down NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 17) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 3 Accepted prefixes: 3 Suppressed due to damping: 0 Advertised prefixes: 2 Last traffic (seconds): Received 16 Sent 1 Checked 63 Input messages: Total 15713 Updates 4 Refreshes 0 Octets 298622 Output messages: Total 15690 Updates 2 Refreshes 0 Octets 298222 Output Queue[0]: 0 Peer: 192.168.40.4+179 AS 17 Local: 192.168.6.5+56466 AS 17 Type: Internal State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ send-direct ] Options: <Preference LocalAddress Refresh> Local Address: 192.168.6.5 Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 192.168.40.4 Local ID: 192.168.6.5 Active Holdtime: 90 Keepalive Interval: 30 Peer index: 1 BFD: disabled, down NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Restart time configured on the peer: 120 Stale routes from peer are kept for: 300 Restart time requested by this peer: 120 NLRI that peer supports restart for: inet-unicast NLRI that restart is negotiated for: inet-unicast NLRI of received end-of-rib markers: inet-unicast NLRI of all end-of-rib markers sent: inet-unicast Peer supports 4 byte AS extension (peer-as 17) Peer does not support Addpath Table inet.0 Bit: 10000 RIB State: BGP restart is complete Send state: in sync Active prefixes: 0 Received prefixes: 2 Accepted prefixes: 2 Suppressed due to damping: 0 Advertised prefixes: 2 Last traffic (seconds): Received 15 Sent 22 Checked 68 Input messages: Total 15688 Updates 2 Refreshes 0 Octets 298111 Output messages: Total 15688 Updates 2 Refreshes 0 Octets 298184 Output Queue[0]: 0
验证 BGP 组
目的
验证 BGP 组是否配置正确。
行动
在操作模式下,输入 show bgp group
命令。
user@A> show bgp group logical-system A Group Type: Internal AS: 17 Local AS: 17 Name: internal-peers Index: 0 Flags: <Export Eval> Export: [ send-direct ] Holdtime: 0 Total peers: 2 Established: 2 192.163.6.4+179 192.168.40.4+179 inet.0: 0/5/5/0 Groups: 1 Peers: 2 External: 0 Internal: 2 Down peers: 0 Flaps: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 5 0 0 0 0 0
验证 BGP 摘要信息
目的
验证 BGP 配置是否正确。
行动
在操作模式下,输入 show bgp summary
命令。
user@A> show bgp summary logical-system A Groups: 1 Peers: 2 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 5 0 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 192.163.6.4 17 15723 15700 0 0 4d 22:13:15 0/3/3/0 0/0/0/0 192.168.40.4 17 15698 15699 0 0 4d 22:13:11 0/2/2/0 0/0/0/0
验证是否已在路由表中安装 BGP 路由
目的
验证导出策略配置是否工作。
行动
在操作模式下,输入 show route protocol bgp
命令。
user@A> show route protocol bgp logical-system A inet.0: 7 destinations, 12 routes (7 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.10.0/30 [BGP/170] 4d 11:05:55, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via lt-0/1/0.1 10.10.10.4/30 [BGP/170] 4d 11:05:55, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via lt-0/1/0.1 [BGP/170] 4d 11:03:10, localpref 100, from 192.168.40.4 AS path: I > to 10.10.10.2 via lt-0/1/0.1 192.163.6.4/32 [BGP/170] 4d 11:05:55, localpref 100, from 192.163.6.4 AS path: I > to 10.10.10.2 via lt-0/1/0.1 192.168.40.4/32 [BGP/170] 4d 11:03:10, localpref 100, from 192.168.40.4 AS path: I > to 10.10.10.2 via lt-0/1/0.1
概述:使用相同的链路本地地址 (IPv6) 在不同链路上配置多个单跳 EBGP 会话
在数据中心或云等复杂网络中,由于链路和节点数量众多,链路本地地址被广泛使用。能够使用链路本地地址为瞻博网络设备部署多个单跳 BGP 会话是一大优势。
从 Junos OS 20.4R1 版开始,您可以在使用相同 IPv6 链路本地地址的多个直接连接对等方的不同链路上启用单跃点 EBGP 会话。对于每个 EBGP 会话,您不再需要为瞻博网络设备提供唯一的对等地址。
示例:使用相同的 IPv6 链路本地地址在不同链路上配置多个单跳 EBGP 会话
此示例说明如何使用相同的 IPv6 链路本地地址在不同链路上配置多个单跳 EBGP 会话。
要求
此示例使用以下硬件和软件组件:
2 个 MX 系列路由器
Junos OS 版本 20.4R1 或更高版本
概述
在 Junos OS 版本 20.4R1 之前,您可以使用链路本地地址配置 BGP 对等方,但是您无法配置多个 BGP 对等方,以便在不同接口上使用相同的链路本地地址。从 Junos OS 20.4R1 开始,您可以使用相同的链路本地地址在不同链路上启用多个单跳 EBGP 会话。
拓扑

配置
在此示例中,您可使用相同的 IPv6 链路本地地址在两个不同链路上配置多个单跳 EBGP 会话。
CLI 快速配置
R1
set interfaces ge-0/0/1
set interfaces ge-0/0/1 description R1-to-R2-Link
set interfaces ge-0/0/1 vlan-tagging
set interfaces ge-0/0/1 unit 1 vlan-id 1
set interfaces ge-0/0/1 unit 1 family inet6 address fe80::10/64
set interfaces ge-0/0/1 unit 2 vlan-id 2
set interfaces ge-0/0/1 unit 2 family inet6 address fe80::10/64
set interfaces lo0 unit 0 family inet address 198.51.100.1/24 primary
set routing-options router-id 198.51.100.1
set routing-options autonomous-system 65541
set protocols bgp group external peer-as 65542
set protocols bgp group external local-as 65541
set protocols bgp group external neighbor fe80::20%ge-0/0/1.1
set protocols bgp group external neighbor "fe80::20%ge-0/0/1.2
R2
set interfaces ge-0/0/1
set interfaces ge-0/0/1 description R2-to-R1-Link
set interfaces ge-0/0/1 vlan-tagging
set interfaces ge-0/0/1 unit 1 vlan-id 1
set interfaces ge-0/0/1 unit 1 family inet6 address fe80::20/64
set interfaces ge-0/0/1 unit 2 vlan-id 2
set interfaces ge-0/0/1 unit 2 family inet6 address fe80::20/64
set interfaces lo0 unit 0 family inet address 198.51.100.2/24 primary
set routing-options router-id 198.51.100.2
set routing-options autonomous-system 65542
set protocols bgp group external peer-as 65541
set protocols bgp group external local-as 65542
set protocols bgp group external neighbor fe80::10%ge-0/0/1.1
set protocols bgp group external neighbor fe80::10%ge-0/0/1.2
使用相同的 IPv6 链路本地地址在多个链路上配置单跃点 EBGP 会话
逐步过程
为 R1 和 R2 配置基本设置,包括 vlan 标记、vlan ID、回传和 IPv6 链路本地地址。
您可以在单个接口上配置多个单元,如下所示:
R1
set interfaces ge-0/0/1
set interfaces ge-0/0/1 description R1-to-R2-Link
set interfaces ge-0/0/1 vlan-tagging
set interfaces ge-0/0/1 unit 1 vlan-id 1
set interfaces ge-0/0/1 unit 1 family inet6 address fe80::10/64
set interfaces ge-0/0/1 unit 2 vlan-id 2
set interfaces ge-0/0/1 unit 2 family inet6 address fe80::10/64
set interfaces lo0 unit 0 family inet address 198.51.100.1/24 primary
R2
set interfaces ge-0/0/1
set interfaces ge-0/0/1 description R2-to-R1-Link
set interfaces ge-0/0/1 vlan-tagging
set interfaces ge-0/0/1 unit 1 vlan-id 1
set interfaces ge-0/0/1 unit 1 family inet6 address fe80::20/64
set interfaces ge-0/0/1 unit 2 vlan-id 2
set interfaces ge-0/0/1 unit 2 family inet6 address fe80::20/64
set interfaces lo0 unit 0 family inet address 198.51.100.2/24 primary
配置路由选项以在 R1 和 R2 上启用 BGP。
R1
set routing-options router-id 198.51.100.1
set routing-options autonomous-system 65541
R2
set routing-options router-id 198.51.100.2
set routing-options autonomous-system 65542
使用格式相同的链路本地 IPv6 地址
set protocols bgp group group neighbor peeraddress%localinterface.unit
在 R1 和 R2 上的多个链路上配置 EBGP:R1
set protocols bgp group external peer-as 65542
set protocols bgp group external local-as 65541
set protocols bgp group external neighbor fe80::20%ge-0/0/1.1
set protocols bgp group external neighbor "fe80::20%ge-0/0/1.2
R2
set protocols bgp group external peer-as 65541
set protocols bgp group external local-as 65542
set protocols bgp group external neighbor fe80::10%ge-0/0/1.1
set protocols bgp group external neighbor fe80::10%ge-0/0/1.2
从配置模式进入
commit
。
结果
检查来自设备的以下配置以如下方法验证您的配置:
下面介绍如何验证 R1 设备上的配置:
user@R1# show interfaces
ge-0/0/1 { description R1-to-R2-Link; vlan-tagging; unit 1 { vlan-id 1; family inet6 { address fe80::10/64; } } unit 2 { vlan-id 2; family inet6 { address fe80::10/64; } } } lo0 { unit 0 { family inet { address 198.51.100.1/24 { primary; } } } }
user@R1# show protocols
bgp { group external { peer-as 65542; local-as 65541; neighbor "fe80::20%ge-0/0/1.1"; neighbor "fe80::20%ge-0/0/1.2"; } }
user@R1# show routing-options
router-id 198.51.100.1; autonomous-system 65541;
验证
验证 EBGP 链路本地支持
目的
使用 命令 show bgp summary
验证通过不同接口具有相同链路本地地址的设备上创建的 EBGP 会话。
行动
user@R1> show bgp summary
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 1 Peers: 2 Down peers: 0
Table Tot Paths Act Paths Suppressed History Damp State Pending
inet6.0
0 0 0 0 0 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
fe80::20%ge-0/0/1.1 65542 115 114 0 0 50:59 Establ
inet6.0: 0/0/0/0
fe80::20%ge-0/0/1.2 65542 114 114 0 0 50:58 Establ
inet6.0: 0/0/0/0
意义
输出表示通过 R1 的 2 个配置本地接口 (ge-0/0/1.1
和ge-0/0/1.2
) 建立 2 个 EBGP 会话时,R2 的 IPv6 链路本地地址 (fe80::20
) 相同。