设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 1371|回复: 0
收起左侧

了解OSPF路由的再分配到BGP

[复制链接]
发表于 2010-8-20 14:50:06 | 显示全部楼层 |阅读模式
此技术说明在Cisco路由 器解释开放式最短路径优先(OSPF)工作情况到边界网关协议(BGP) 再分配。OSPF工作情况到BGP再分配在 RFC 1403 概述  . 路由可以被过滤在OSPF期间到BGP再分配在 route-map命令帮助下。默认行为是不再分布任何路由从OSPF到BGP .换句话说, simple redistribute命令,例 如 重新分配ospf 1 在路由器BGP 1之下 不工作 .特定关键字喜欢 内部, 外部 并且 NSSA外部 要求再分布各自路由。
  在您开始之前
  惯例
  欲知关于文件惯例的更多信息,请参阅 Cisco技 术提示惯例。
  前提
  此文档没有特殊的先决 条件。
  使 用的组件
  本文不限于特 定软件和硬件版本。
  本文提供的信 息在特定实验室环境里从设备被创建了。用于本文的所有设 备开始了以一个缺省(默认)配置。如果在一个真实网络工 作,保证您使用它以前了解所有命令的潜在影响。
  网络建立
  有再分布OSPF路由四个 案件到讨论的BGP以下。网络图适用于前三个案件。 图表和设置为第四个案件在OSPF NSSA 外部路由的 再分配可以查找 到 BGP
  左网云运行OSPF和BGP在AS 100之下。 正确的网云运行BGP在 AS 200之下。 路由器C没为AS 100看见任何路由从路由器B 因为OSPF重新分配到BGP在路由器B,并且配置错过关键字 外部 和 内部。
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setC    3.0.0.0/8 is directly connected, Serial0[/pre]
  路由器B的当前配置如下所示。在此配置,路 由器B (RTB)使用 为其他路由 协议正常使用的simple redistribution命令。关于再分配 示例为其他路由协议,请参阅 重新分配路由 协议。
  路由器B的当前配置
[pre]RTBhostname RTB!interface Ethernet0  ip address 2.2.2.1 255.0.0.0!interface Serial1  ip address 3.3.3.1 255.0.0.0!router ospf 1  network 2.0.0.0 0.255.255.255 area 1!router bgp 100  redistribute ospf 1!-- No keyword is used while redistributing OSPF routes into BGP  neighbor 3.3.3.3 remote-as 200!end[/pre]
  路由器B了解以 下路由从OSPF:
[pre]RTB#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, 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 routeGateway of last resort is not setO E2 200.1.1.0/24 [110/20] via 2.2.2.2, 00:22:53, Ethernet0O E1 200.2.2.0/24 [110/20] via 2.2.2.2, 00:22:53, Ethernet0O IA 131.108.1.0/24 [110/20] via 2.2.2.2, 00:22:53, Ethernet0O 131.108.2.0/24 [110/20] via 2.2.2.1, 00:22:53, Ethernet0C    2.0.0.0/8 is directly connected, Ethernet0C    3.0.0.0/8 is directly connected, Serial1[/pre]
仅OSPF内部(域间与域内)路由的再分配到BGP里  在这种情况下,仅 OSPF区域内和区域间路由再分布到BGP.再分布OSPF内部和 区域间路由,与 redistribute命令一起 使用内部关键字在 路由器BGP之下。以下再分布区域内路由的一个新的路由器B配置(131.108.2.0/24)和仅区域间路由(131.108.1.0/24) 到BGP.
[pre]RTBhostname RTB!interface Ethernet0  ip address 2.2.2.1 255.0.0.0!interface Serial1  ip address 3.3.3.1 255.0.0.0!router ospf 1  network 2.0.0.0 0.255.255.255 area 1!router bgp 100  redistribute ospf 1 match internal!-- This redistributes only OSPF intra- and inter-area routes into BGP  neighbor 3.3.3.3 remote-as 200!end[/pre]
  在做配置更改以后,路由器C起动了解这两个路由 从BGP:
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    131.108.1.0/24 [20/20] via 3.3.3.1, 00:01:43B    131.108.2.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  OSPF仅外部(第一类型和2)路由的再分配到BGP里
  再分布OSPF外部路由 到BGP,与 redistribute命令一起 使用 外部关 键字在 路由器BGP之下。 带有此关键字,您有三个选择: 重新分配外部第一类型、第二类型,或者两个类型。 默认值是重新分配两个类型。输入命令在配置模式 如下:
[pre]RTBhostname RTB!interface Ethernet0  ip address 2.2.2.1 255.0.0.0!interface Serial1  ip address 3.3.3.1 255.0.0.0!router ospf 1  network 2.0.0.0 0.255.255.255 area 1!router bgp 100  redistribute ospf 1 match external 1 external 2!-- This redistributes all OSPF external routes into BGP  neighbor 3.3.3.3 remote-as 200!end[/pre]
在如下配置我们使用 外 部1外部2.默认情况下因为外部关 键字重新分配 两 OSPF外部1以及外部2 路由,这是正常的。 以下新的路由器B 配置,允许我们重新分配OSPF外部 1 (200.2.2.0/24) 并且OSPF外部2路由(200.1.1.0/24)到BGP.
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.1.1.0/24 [20/20] via 3.3.3.1, 00:01:43B    200.2.2.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  注意: 配置显示 匹配外部1外部2 和被输入 的命令是 重新分配ospf 1 匹配外部。因为OSPF在配置,自动添附"外部 1外部2"这是正常的。 它匹配OSPF外部1并且外部2路由和再 分布两个路由到BGP.
  在做配置 更改以后,路由器C起动了解关于这两OSPF外部路由从BGP:
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.2.2.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  只将 OSPF外部类型1路由再分配到BGP
  再分布OSPF仅外部1路由,输入以下命令在 路由器BGP 100之下 在路由器B:
[pre]router bgp 100redistribute ospf 1 match external 2[/pre]
  路由路由器表C表示,从BGP只接受外部1路由并且其他OSPF路由没有再 分布到BGP.
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.1.1.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
只将OSPF外部类型2路由再分配到 BGP  再分布OSPF仅外 部2路由,输入以下命令在 路由器BGP 100之 下 在路由器B:
[pre]router bgp 100redistribute ospf 1 match external 2[/pre]
  路由路由器表C表示,从BGP只接受E2 路由并且其 他OSPF路由没有再分布到BGP。
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.1.1.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  OSPF内部路由与外部路由 再分布OSPF 内部路由与外部路由再分配到BGP里
  所有OSPF路由在路由器B配置在这 种情况下再分布到 BGP 通过 使用 内部和外部关键字,如 显示如下:
[pre]RTBhostname RTB!interface Ethernet0  ip address 2.2.2.1 255.0.0.0!interface Serial1  ip address 3.3.3.1 255.0.0.0!router ospf 1  network 2.0.0.0 0.255.255.255 area 1!router bgp 100  redistribute ospf 1 match internal external 1 external 2!-- This redistributes all OSPF routes into BGP  neighbor 3.3.3.3 remote-as 200!end[/pre]
  再次, 外部 用外部 1外部2 替换 在配置。这是正常的 除非指定哪些特定外部路由您想要再分布到BGP.在做配置 更改以后,路由器C起动了解所有OSPF路由从BGP:
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    131.108.1.0/24 [20/20] via 3.3.3.1, 00:01:43B    131.108.2.0/24 [20/20] via 3.3.3.1, 00:01:43B    200.1.1.0/24 [20/20] via 3.3.3.1, 00:01:43B    200.2.2.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
 OSPF NSSA外部路由的再分配到BGP 里  这是仅次未节区域 (NSSA)的一种特殊情形路由再分布到BGP.此案件于 仅OSPF外部 (第一类型和2) 路由的再分配是非常类似的到BGP.唯一的区别是BGP现在匹配NSSA 外部路由而不是外部路由。路由路由器表B显示这些 OSPF NSSA外部路由:
[pre]RTB#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, 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 routeGateway of last resort is not setO N2 200.1.1.0/24 [110/20] via 2.2.2.1, 00:22:53, Ethernet0O N1 200.2.2.0/24 [110/20] via 2.2.2.2, 00:22:53, Ethernet0O IA 131.108.1.0/24 [110/20] via 2.2.2.2, 00:22:53, Ethernet0O 131.108.2.0/24 [110/20] via 2.2.2.1, 00:22:53, Ethernet0C    2.0.0.0/8 is directly connected, Ethernet0C    3.0.0.0/8 is directly connected, Serial1[/pre]
  以下网络 图为此案件使用:
  在以上图表,路由器B是接收两OSPF N1以及N2路由。 如果使用,默认行为是重新分配N1和N2路由 仅 NSSA 外部关键字。以下路由器B配置允许我们再分布 OSPF N1 (200.2.2.0/24)和OSPF N2 (200.1.1.0/24) 路由到BGP.
[pre]RTBhostname RTB!interface Ethernet0  ip address 2.2.2.1 255.0.0.0!interface Serial1  ip address 3.3.3.1 255.0.0.0!router ospf 1  network 2.0.0.0 0.255.255.255 area 1nssa!router bgp 100  redistribute ospf 1 match nssa-external 1 nssa-external 2!-- This redistributes all OSPF NSSA-external routes into BGP  neighbor 3.3.3.3 remote-as 200!end[/pre]
  注意: 类似OSPF外部配置 ,上述配置显示 匹配NSSA 外部1 NSSA外部 2 并且被输入的命令是 重新分配ospf 1匹配NSSA 外部。因为OSPF在配置,自动添附"NSSA 外部1 NSSA外部2"这是正常的。 它匹配OSPF N1和OSPF N2 路由并且再分布两个路由到BGP.

 在做配置更改以后在路由器B,路由器C起动了解 OSPF NSSA外部路由从BGP:
[pre]TC#show ip routeCodes:  C - connected, S - static, I -    IGRP, R - RIP, M - mobile, B - BGPD -    EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate defaultU - per-user static route, o - ODRGateway of last resort is not setB    200.1.1.0/24 [20/20] via 3.3.3.1, 00:01:43B    200.2.2.0/24    [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  只将OSPF NASS外部类型1 路由再分配到BGP
  再分布仅OSPF N1路由,输入以下命令在 路由 器BGP 100之下 在路由器B:
[pre]router bgp 100redistribute ospf 1 match nssa-external 1[/pre]
  路由路由器表C表示,从BGP只接 受N1 路由并且其他OSPF路由没有再分布到BGP.
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.2.2.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  只将 OSPF NASS外部类型2路由再分配到 BGP
  如果需求是再分 布仅OSPF N2路由,输入以下命令在 路由器 BGP 100之下 在路由器B:
[pre]router bgp 100redistribute ospf 1 match nssa-external 2[/pre]
  路由路由器表C表示,从BGP只接 受N1 路由并且其他OSPF路由没有再分布到BGP.
[pre]RTC#show ip routeCodes: C - connected, S - static, I - IGRP, 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, E - EGP        i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default        U - per-user static route, o - ODRGateway of last resort is not setB    200.1.1.0/24 [20/0] via 3.3.3.1, 00:01:43C    3.0.0.0/8 is directly connected, Serial0[/pre]
  类似于配置在 OSPF内部路由与外部路由再分布OSPF内部路 由与外部路由再分配到BGP,如果所有 OSPF 路由需要再分布到BGP当配置时NSSA,关键字 外部 用关键字替换 NSSA外部:
[pre]RTB(config-router)#router bgp 100RTB(config-router)#redistribute ospf 1 match internal nssa-external[/pre]
  注意: 即使我们输入了 NSSA外部 上述,默认情况下更改到 NSSA外部1 NSSA 外部 2.
[pre]router bgp 100redistribute ospf 1 match internal nssa-external 1 nssa-external 2[/pre]
您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-5-12 01:03 , Processed in 0.051498 second(s), 7 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表