了解OSPF路由到BGP的重分发 您所在的位置:网站首页 思科bgp汇总 了解OSPF路由到BGP的重分发

了解OSPF路由到BGP的重分发

2024-07-13 17:51| 来源: 网络整理| 查看: 265

简介

本文档介绍思科路由器上开放最短路径优先(OSPF)到边界网关协议(BGP)重分发的行为。

先决条件 要求

Cisco建议您先了解OSPF路由类型,然后再使用本文档。

使用的组件

本文档不限于特定的软件和硬件版本。

本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。

规则

有关文档规则的详细信息,请参阅 Cisco 技术提示规则。

背景信息

本技术说明解释思科路由器上OSPF到BGP重分发的行为。RFC 1403中概述了OSPF到BGP重分发的行为。有几种类型的 OSPF 路由:

区域内路由 — 在多区域OSPF网络中,同一区域内的路由器将源自某一区域的路由称为区域内路由。这些路由在 show ip route 命令输出.

域间——当路由穿过OSPF局域边界路由器(ABR)时,路由一般被称为OSPF区域间路由。这些路由在 show ip route  命令输出.

区域内路由和区域间路由也称为OSPF内部路由,因为它们由OSPF自身生成,当某个接口为OSPF覆盖时 network   命令。

External Type-2或External Type-1 — 重分发到OSPF的路由(例如Connected、Static或其他路由协议)称为External Type-2或External Type-1。这些路由在 show ip route  命令输出.

NSSA External Type-2或NSSA External Type 1 — 将某个区域配置为非末节区域(NSSA)并将路由重分配到OSPF中时,这些路由称为NSSA External Type-2或NSSA External Type-1。这些路由在路由表中标记为O N2或O N1 show ip route  命令输出.

解释外部和NSSA第2类或1类之间的差异超出了本文档的范围 — 有关详细信息,请参阅《OSPF设计指南》。

默认行为是不将任何路由从 OSPF 重分配到 BGP 中。必须配置重分配。您可以使用  route-map  命令在OSPF到BGP重分发期间过滤路由。要完成重分发,特定关键字 internal, external, 和 nssa-external  重分发各自的路由。

网络设置

下面讨论四种将OSPF路由重分发到BGP的情况。网络图适用于前三个案例。第四个情况的图和设置可在OSPF NSSA外部路由重分配到BGP部分中找到。

将OSPF重分发到BGP拓扑A

仅将OSPF内部(区域内和区域间)路由重分配到BGP

如果您配置将OSPF重分发到BGP而不使用关键字,默认情况下,只有OSPF区域内和区域间路由重分发到BGP。您可以使用 internal 关键字以及 redistribute 命令下 router bgp  重分布OSPF区域内和区域间路由。

此配置是仅将区域内路由 (10.108.2.0/24) 和区域间路由 (10.108.1.0/24) 重分配到 BGP 中的路由器 B 的新配置,并且只会将 OSPF 内部(区域内和区域间)路由重分配到 BGP 中:

RTB hostname RTB ! interface GigabitEthernet0/0 ip address 10.3.3.1 255.255.255.0 duplex auto speed auto media-type rj45 ! interface GigabitEthernet0/1 ip address 10.2.2.3 255.255.255.0 duplex auto speed auto media-type rj45  ! router ospf 1 network 10.2.2.0 0.0.0.255 area 1  ! router bgp 100 redistribute ospf 1 !-- This redistributes only OSPF intra-area and inter-area routes into BGP.

neighbor 10.3.3.2 remote-as 200 ! end

RTB#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks C 10.2.2.0/24 is directly connected, GigabitEthernet0/1 L 10.2.2.3/32 is directly connected, GigabitEthernet0/1 C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.1/32 is directly connected, GigabitEthernet0/0 O IA 10.108.1.0/24 [110/3] via 10.2.2.2, 00:08:38, GigabitEthernet0/1 O 10.108.2.0/24 [110/2] via 10.2.2.2, 00:39:13, GigabitEthernet0/1 O E2 192.168.1.0/24 [110/20] via 10.2.2.2, 00:07:39, GigabitEthernet0/1 O E1 192.168.2.0/24 [110/23] via 10.2.2.2, 00:07:38, GigabitEthernet0/1 RTB#

路由器 B 只会重分配 OSPF 内部路由:

RTB#show ip bgp BGP table version is 12, local router ID is 10.3.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.2.2.0/24 0.0.0.0 0 32768 ? *> 10.108.1.0/24 10.2.2.2 3 32768 ? *> 10.108.2.0/24 10.2.2.2 2 32768 ? RTB#

路由器C从BGP获取以下路由:

RTC#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks B 10.2.2.0/24 [20/0] via 10.3.3.1, 00:07:07 C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.2/32 is directly connected, GigabitEthernet0/0 B 10.108.1.0/24 [20/3] via 10.3.3.1, 00:07:07 B 10.108.2.0/24 [20/2] via 10.3.3.1, 00:07:07 RTC# RTC#show ip bgp BGP table version is 8, local router ID is 10.3.3.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.2.2.0/24 10.3.3.1 0 0 100 ? *> 10.108.1.0/24 10.3.3.1 3 0 100 ? *> 10.108.2.0/24 10.3.3.1 2 0 100 ? RTC# 只将 OSPF 外部(类型 1 和 2)路由重分配到 BGP 中

请使用  external  关键字以及 redistribute  命令下 router bgp  将OSPF外部路由重分发到BGP。使用 external  关键字,您有三种选择:

重新分发外部类型1和类型2(默认)

重新分发类型1

重新分发类型2

在配置模式下输入命令,如下所示:

RTB(config-router)#router bgp 100 RTB(config-router)#redistribute ospf 1 match external

在路由器B的此配置中,仅重分布OSPF外部路由,但重分布类型1和类型2:

RTB hostname RTB ! interface GigabitEthernet0/0 ip address 10.3.3.1 255.255.255.0 duplex auto speed auto media-type rj45 ! interface GigabitEthernet0/1 ip address 10.2.2.3 255.255.255.0 duplex auto speed auto media-type rj45  ! router ospf 1 network 10.2.2.0 0.0.0.255 area 1  ! router bgp 100   redistribute ospf 1 match external 1 external 2

!--- This redistributes ONLY OSPF External routes, but both type-1 and type-2.

neighbor 10.3.3.2 remote-as 200 ! end

注意:配置显示 match external 1 external 2  输入的命令是 redistribute ospf 1 match external. 这是正常现象,因为OSPF自动附加 external 1 external 2  配置。它同时匹配OSPF外部1和外部2路由,并且将两个路由重新分配到BGP中。

路由器B仅重分发OSPF外部路由:

RTB#show ip bgp BGP table version is 25, local router ID is 10.3.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.2.2.2 20 32768 ? *> 192.168.2.0 10.2.2.2 23 32768 ? RTB#

路由器 C 从 BGP 了解这两个 OSPF 外部路由:

RTC#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.2/32 is directly connected, GigabitEthernet0/0 B 192.168.1.0/24 [20/20] via 10.3.3.1, 00:02:16 B 192.168.2.0/24 [20/23] via 10.3.3.1, 00:02:16 RTC#show ip bgp BGP table version is 21, local router ID is 10.3.3.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.3.3.1 20 0 100 ? *> 192.168.2.0 10.3.3.1 23 0 100 ? RTC# 只将 OSPF 外部类型 1 或 2 路由重分配到 BGP 中

在 router bgp 100  命令,仅重分发OSPF External 1路由:

RTB(config)#router bgp 100 RTB(config-router)#redistribute ospf 1 match external 1

使用之前的配置,路由器B(RTB)BGP表显示它只能将外部1路由重分发到BGP,而所有其他OSPF路由不能重分发到BGP:

RTB#show ip bgp BGP table version is 28, local router ID is 10.3.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.2.0 10.2.2.2 23 32768 ? RTB#

同样,请在以下位置输入此命令 router bgp 100  在路由器B上仅重分发OSPF外部2路由:

RTB(config)#router bgp 100 RTB(config-router)#redistribute ospf 1 match external 2 将 OSPF 内部路由与外部路由重分配到 BGP 中

在这种情况下,所有OSPF路由都使用这两者重分发到BGP internal  和 external  命令中的关键字 redistribute ospf match internal external 如路由器B配置所示:

RTB hostname RTB ! interface GigabitEthernet0/0 ip address 10.3.3.1 255.255.255.0 duplex auto speed auto media-type rj45 ! interface GigabitEthernet0/1 ip address 10.2.2.3 255.255.255.0 duplex auto speed auto media-type rj45  ! router ospf 1 network 10.2.2.0 0.0.0.255 area 1  ! router bgp 100 redistribute ospf 1 match internal external 1 external 2

!--- This redistributes all OSPF routes into BGP.

neighbor 10.3.3.2 remote-as 200 ! end

同样, external  替换为 external 1 external 2  配置。这是正常的,只有您指定希望重新分配到BGP的那些特定外部路由时除外。完成配置更改后,路由器B重新分发所有OSPF路由,而路由器C开始从BGP获取所有路由:

RTB#show ip bgp BGP table version is 6, local router ID is 10.3.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.2.2.0/24 0.0.0.0 0 32768 ? *> 10.108.1.0/24 10.2.2.2 3 32768 ? *> 10.108.2.0/24 10.2.2.2 2 32768 ? *> 192.168.1.0 10.2.2.2 20 32768 ? *> 192.168.2.0 10.2.2.2 23 32768 ? RTB#  RTC#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks B 10.2.2.0/24 [20/0] via 10.3.3.1, 00:03:27 C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.2/32 is directly connected, GigabitEthernet0/0 B 10.108.1.0/24 [20/3] via 10.3.3.1, 00:03:27 B 10.108.2.0/24 [20/2] via 10.3.3.1, 00:03:27 B 192.168.1.0/24 [20/20] via 10.3.3.1, 00:03:27 B 192.168.2.0/24 [20/23] via 10.3.3.1, 00:03:27 RTC# 将 OSPF NSSA 外部路由重分配到 BGP 中

这是一种特殊情况,其中只有NSSA路由重分发到BGP。这种情况与仅将OSPF外部(类型1和2)路由重分配到BGP部分中描述的情况非常相似。唯一的区别是OSPF现在匹配NSSA外部路由,而不只是外部路由。路由器 B 的路由表显示了这些 OSPF NSSA 外部路由:

RTB#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks C 10.2.2.0/24 is directly connected, GigabitEthernet0/1 L 10.2.2.3/32 is directly connected, GigabitEthernet0/1 C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.1/32 is directly connected, GigabitEthernet0/0 O IA 10.108.1.0/24 [110/3] via 10.2.2.2, 00:05:00, GigabitEthernet0/1 O 10.108.2.0/24 [110/2] via 10.2.2.2, 00:05:00, GigabitEthernet0/1 O N2 192.168.1.0/24 [110/20] via 10.2.2.1, 00:10:14, GigabitEthernet0/1 O N1 192.168.2.0/24 [110/22] via 10.2.2.2, 00:03:43, GigabitEthernet0/1 RTB#

此网络图用于此案例:

将OSPF重分发到BGP拓扑B

网络图显示路由器 B 同时接收 OSPF N1 和 N2 路由。默认行为是重新分配N1和N2路由,如果仅 nssa-external 使用关键字。路由器B的此配置允许我们将OSPF N2(192.168.1.0/24)和OSPF N1(192.168.2.0/24)路由重分发到BGP:

RTB hostname RTB ! interface GigabitEthernet0/0 ip address 10.3.3.1 255.255.255.0 duplex auto speed auto media-type rj45 ! interface GigabitEthernet0/1 ip address 10.2.2.3 255.255.255.0 duplex auto speed auto media-type rj45  ! router ospf 1 area 1 nssa  network 10.2.2.0 0.0.0.255 area 1  ! router bgp 100 redistribute ospf 1 match nssa-external 1 nssa-external 2 !--- This redistributes only OSPF NSSA-external routes Type-1 and Type-2 into BGP. neighbor 10.3.3.2 remote-as 200 ! end

注意:与OSPF外部配置类似,系统会显示之前的配置 match nssa-external 1 nssa-external 2  输入的命令是 redistribute ospf 1 match nssa-external.这是正常现象,因为OSPF自动附加 nssa-external 1 nssa-external 2 配置。它匹配OSPF N1和OSPF N2路由,并且把这两个路由重新分配到BGP。

在路由器B上更改配置后,它会重新分配OSPF NSSA外部路由,而路由器C从BGP获取OSPF NSSA外部路由:

RTB#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks C 10.2.2.0/24 is directly connected, GigabitEthernet0/1 L 10.2.2.3/32 is directly connected, GigabitEthernet0/1 C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.1/32 is directly connected, GigabitEthernet0/0 O IA 10.108.1.0/24 [110/3] via 10.2.2.2, 00:09:40, GigabitEthernet0/1 O 10.108.2.0/24 [110/2] via 10.2.2.2, 00:09:40, GigabitEthernet0/1 O N2 192.168.1.0/24 [110/20] via 10.2.2.1, 00:14:54, GigabitEthernet0/1 O N1 192.168.2.0/24 [110/22] via 10.2.2.2, 00:08:23, GigabitEthernet0/1 RTB# RTB#show ip bgp BGP table version is 17, local router ID is 10.3.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.2.2.1 20 32768 ? *> 192.168.2.0 10.2.2.2 22 32768 ? RTB#  RTC#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.3.3.0/24 is directly connected, GigabitEthernet0/0 L 10.3.3.2/32 is directly connected, GigabitEthernet0/0 B 192.168.1.0/24 [20/20] via 10.3.3.1, 00:01:29 B 192.168.2.0/24 [20/22] via 10.3.3.1, 00:01:29 RTC# RTC#show ip bgp BGP table version is 41, local router ID is 10.3.3.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.3.3.1 20 0 100 ? *> 192.168.2.0 10.3.3.1 22 0 100 ? RTC#

与OSPF外部路由一样,要仅重分布OSPF N1路由,请在路由器B的路由器BGP 100下输入以下命令:

RTB(config)#router bgp 100 RTB(config-router)#redistribute ospf 1 match nssa-external 1

!--- This redistributes only OSPF NSSA-external Type-1 routes into BGP.

要仅重分布OSPF N2路由,请在路由器B的路由器BGP 100下输入以下命令:

RTB(config)#router bgp 100 RTB(config-router)#redistribute ospf 1 match nssa-external 2

!--- This redistributes only OSPF NSSA-external Type-2 routes into BGP.

注意:路由映射也可用于将OSPF类型1/2重分发到BGP。有关详细信息,请参阅在BGP中重分布OSPF E2路由。

修改 OSPF 中的重分配选项

了解后续配置更改如何更改配置非常重要。带有match选项的新命令不会覆盖上一个命令,但会添加到该命令中。下一个示例说明配置命令序列如何影响重分发:

R4#configure terminal R4(config)#router bgp 100 R4(config-router)#redistribute ospf 1 match internal R4(config-router)#^Z !--- Initially, you redistribute internal OSPF routes into BGP 100. R4#show run | include redistribute ospf redistribute ospf 1 match internal R4#configure terminal R4(config)#router bgp 100 R4(config-router)#redistribute ospf 1 match external R4(config-router)#^Z !--- With this second command, you tell BGP to also redistribute external OSPF routes. R4#show run | include redistribute ospf redistribute ospf 1 match internal external 1 external 2 R4# R4#configure terminal R4(config)#router bgp 100 R4(config-router)#no redistribute ospf 1 match external 2 R4(config-router)#^Z !--- With this no command, you only disable the redistribution of external type 2 into BGP. !--- All other types of routes previously configured remain. R4#show run | include redistribute ospf redistribute ospf 1 match internal external 1 !--- As you can see, internal and external type 1 remain. R4#configure terminal R4(config)#router bgp 100 R4(config-router)#no redistribute ospf 1 match internal external 1 R4(config-router)#^Z !--- Now, with this no command, which includes all configured keywords, it is important to note that you !--- still do not disable the redistribution fully. you only removed the keyword. After this, !--- the IOS still acts as default—redistributing internal routes only. R4#show run | include redistribute ospf redistribute ospf 1 R4#configure terminal R4(config)#router bgp 100 R4(config-router)#no redistribute ospf 1 !--- Always use the previous command in order to completely disable redistribution. R4(config-router)# ^Z R4#show run | include redistribute ospf R4# 无法将iBGP获知的路由重分发到IGP,例如EIGRP和OSPF

路由重分配用于将使用一种协议了解的路由传播到另一种路由协议中。当 BGP 重分配到 IGP 中,只会重分配 eBGP 了解的路由。内部边界网关协议(iBGP)在路由器上获知的路由不会引入到IGP中,以防止产生路由环路。

默认情况下,iBGP重分发到IGP是禁用的。发出  bgp redistribute-internal  命令,以便将iBGP路由重分发到IGP。需要采取预防措施,才能使用路由映射将特定路由重分配到IGP中。

将iBGP路由重分配到OSPF的示例配置如下所示:

Router(config)#router bgp 65345 Router(config-router)#bgp redistribute-internal ! Router(config)#router ospf 100 Router(config-router)#redistribute bgp 65345 subnets

注意:将iBGP路由重分发到内部网关协议可能导致自治系统(AS)内的路由环路。不推荐这样做。需要设置路由过滤器,以控制导入 IGP 的信息。

将OSPF默认路由重分发到BGP

要将默认路由重分发到BGP,请使用 network  声明和 default-information originate. 在本例中,OSPF默认路由被重分发到BGP。创建路由映射并分配默认网络(标准ACL允许这样做)即可完成此操作。

! route-map map_default_only permit 10 match ip address acl_default_only ! ip access-list standard acl_default_only permit 0.0.0.0 ! router bgp 64601 network 0.0.0.0 redistribute ospf 1 route-map map_default_only default-information originate !

!--- Distributes the default route in bgp

配置后,清除与的bgp会话 clear ip bgp *   命令。

相关信息 OSPF:常见问题 常见问题BGP 技术支持和文档 - Cisco Systems


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有