BGP 对等会话
使用外部 BGP 对等方组的优势
BGP 是当今唯一适合于承载互联网上所有路由的路由协议。这主要是因为 BGP 在 TCP 之上运行,并且可以利用 TCP 流控制。相比之下,内部网关协议 (IGP) 没有流控制。当 IGP 拥有过多的路由信息时,它们就会开始流失。当 BGP 的相邻发送方发送信息过快时,BGP 可以通过延迟 TCP 确认来限制邻接方。
BGP 的另一个好处是(与 IS-IS 一样)它使用类型、长度、值 (TLV) 元组和网络层可达性信息 (NLRI),无需更改底层协议即可提供看似无限的可扩展性。
在 Junos OS 中,BGP 完全由策略驱动。运维人员必须显式配置邻接方以便与之对等,并明确接受进入 BGP 的路由。此外,路由策略还用于过滤和修改路由信息。因此,路由策略提供了对路由表的完全管理控制。
配置大量 BGP 对等体邻接方的首选方法是配置对等组,每个组由多个邻接方组成。
随着外部 BGP (EBGP) 组数量的增加,支持大量 BGP 会话的能力可能会成为 CPU 和内存资源扩展问题。通常,支持较少的 EBGP 组比支持大量 EBGP 组具有更好的可扩展性。与少数 EBGP 组(每个组中有多个对等方)相比,这在数百个 EBGP 组的情况下变得更加明显。出现这种扩展行为的原因是 Junos OS 的数据结构是按每个路由、按组生成的。添加组时,将这些数字相乘并减少可用内存量。
BGP 对等互连在两个独立的自治系统 (AS) 之间建立互惠互利的流量交换关系。它在服务提供商交换点尤其有用。这种关系的主要好处是降低了两个网络的传输成本和设备资源。创建 BGP 对等体组的其他潜在好处包括降低 BGP 配置的复杂性,以及通过减少对传输提供商的依赖来增加路由冗余。
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 对等方后,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 编号。
邻接方配置将覆盖组配置。因此,while 为组中的所有其他邻居设置,
peer-as 79而peer-as 22为邻居 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) 17 中的设备 E 与一组称为外部 对等方的 BGP 对等体会话。对等方 A、B 和 C 驻留在 AS 22 中。此示例显示了逻辑系统 A 和逻辑系统 E 上的分步配置。
拓扑结构
的典型网络
配置
过程
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层次结构级别的 [edit] CLI 中,然后从配置模式进入。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 protocols bgp group external-peers family inet6 unicast 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 protocols bgp group external-peers family inet6 unicast 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 protocols bgp group external-peers family inet6 unicast 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 protocols bgp group external-peers family inet6 unicast 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 protocols bgp group external-peers family inet6 unicast 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 上,配置指向对等方 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 上,配置指向对等方 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 地址。此示例中的 BGP
neighbor语句中使用了 2001 地址。注意: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:1dauser@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 user@R1:A# set family inet6 unicast
在逻辑系统 E 上,创建 BGP 组,并添加外部邻接方地址。
[edit protocols bgp group external-peers] user@R1:E# set neighbor 2001:db8:0:1:2a0:a502:0:1da user@R1:E# set family inet6 unicast
在逻辑系统 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
意义
关闭对等方: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 中,设备 Jackson、设备 Memphis 和设备 Biloxi 彼此之间有 IBGP 对等会话。同样,设备 Miami 和设备 Atlanta 彼此之间有 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 中的设备在内部对 等方组中处于全网状状态。设备的环路地址为 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。
即使设备 A 未直接连接到设备 C,设备 B 和设备 C 也包含这些
neighbor语句。[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。
即使设备 A 未直接连接到设备 C,设备 B 和设备 C 也包含这些
neighbor语句。[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。
即使设备 A 未直接连接到设备 C,设备 B 和设备 C 也包含这些
neighbor语句。[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 中的设备在内部对 等方组中处于全网状状态。设备的环路地址为 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 上,即使逻辑系统 A 未直接连接到设备 C,设备 B 和设备 C 也会包含这些
neighbor语句。[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/1set interfaces ge-0/0/1 description R1-to-R2-Linkset interfaces ge-0/0/1 vlan-taggingset interfaces ge-0/0/1 unit 1 vlan-id 1set interfaces ge-0/0/1 unit 1 family inet6 address fe80::10/64set interfaces ge-0/0/1 unit 2 vlan-id 2set interfaces ge-0/0/1 unit 2 family inet6 address fe80::10/64set interfaces lo0 unit 0 family inet address 198.51.100.1/24 primaryset routing-options router-id 198.51.100.1set routing-options autonomous-system 65541set protocols bgp group external peer-as 65542set protocols bgp group external local-as 65541set protocols bgp group external neighbor fe80::20%ge-0/0/1.1set protocols bgp group external neighbor "fe80::20%ge-0/0/1.2
R2
set interfaces ge-0/0/1set interfaces ge-0/0/1 description R2-to-R1-Linkset interfaces ge-0/0/1 vlan-taggingset interfaces ge-0/0/1 unit 1 vlan-id 1set interfaces ge-0/0/1 unit 1 family inet6 address fe80::20/64set interfaces ge-0/0/1 unit 2 vlan-id 2set interfaces ge-0/0/1 unit 2 family inet6 address fe80::20/64set interfaces lo0 unit 0 family inet address 198.51.100.2/24 primaryset routing-options router-id 198.51.100.2set routing-options autonomous-system 65542set protocols bgp group external peer-as 65541set protocols bgp group external local-as 65542set protocols bgp group external neighbor fe80::10%ge-0/0/1.1set protocols bgp group external neighbor fe80::10%ge-0/0/1.2
使用相同的 IPv6 链路本地地址在多个链路上配置单跃点 EBGP 会话
分步程序
-
配置基本设置,包括 R1 和 R2 的 VLAN 标记、VLAN ID、环路和 IPv6 链路本地地址。
您可以在单个接口上配置多个设备,如下所示:
R1set interfaces ge-0/0/1set interfaces ge-0/0/1 description R1-to-R2-Linkset interfaces ge-0/0/1 vlan-taggingset interfaces ge-0/0/1 unit 1 vlan-id 1set interfaces ge-0/0/1 unit 1 family inet6 address fe80::10/64set interfaces ge-0/0/1 unit 2 vlan-id 2set interfaces ge-0/0/1 unit 2 family inet6 address fe80::10/64set interfaces lo0 unit 0 family inet address 198.51.100.1/24 primaryR2
set interfaces ge-0/0/1set interfaces ge-0/0/1 description R2-to-R1-Linkset interfaces ge-0/0/1 vlan-taggingset interfaces ge-0/0/1 unit 1 vlan-id 1set interfaces ge-0/0/1 unit 1 family inet6 address fe80::20/64set interfaces ge-0/0/1 unit 2 vlan-id 2set interfaces ge-0/0/1 unit 2 family inet6 address fe80::20/64set 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.1set routing-options autonomous-system 65541R2
set routing-options router-id 198.51.100.2set routing-options autonomous-system 65542 -
在 R1 和 R2 上的多个链路上使用相同的链路本地 IPv6 地址配置 EBGP,格式如下
set protocols bgp group group neighbor peeraddress%localinterface.unit:R1set protocols bgp group external peer-as 65542set protocols bgp group external local-as 65541set protocols bgp group external neighbor fe80::20%ge-0/0/1.1set protocols bgp group external neighbor "fe80::20%ge-0/0/1.2R2set protocols bgp group external peer-as 65541set protocols bgp group external local-as 65542set protocols bgp group external neighbor fe80::10%ge-0/0/1.1set 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),使用 R2 的相同 IPv6 链路本地地址 (fe80::20) 建立 2 个 EBGP 会话。