了解BGP中的路由聚合

您所在的位置:网站首页 bgp路由配置实例 了解BGP中的路由聚合

了解BGP中的路由聚合

#了解BGP中的路由聚合| 来源: 网络整理| 查看: 265

简介

本文档介绍如何在使用 aggregate-address 命令以及如何影响传播。

先决条件 要求

Cisco 建议您了解以下主题:

基本BGP操作。有关详细信息,请参阅BGP案例研究。

使用的组件

本文档不限于特定的软件和硬件版本。不过,本文档中的配置已经过 Cisco IOS® 软件版本 12.2(28) 测试。

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

规则

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

背景信息

边界网关协议(BGP)允许使用 aggregate-address address mask [as-set] [summary-only] [suppress-map map-name ] [advertise-map map-name ] [attribute-map map-name ]   命令。当您发出  aggregate-address 命令没有任何参数,不会继承单个路由属性(如AS_PATH或社区),这会导致粒度损失。本文档说明如何在使用时操作不同的属性 aggregate-address 命令以及如何影响传播。

网络图

网络图

不包含  as-set  参数

使用 as-set 参数创建具有自治系统(AS)的数学集的聚合地址。此 as-set 参数汇总了所有单个路由的AS_PATH属性。使用以下示例配置可以检查此功能,并了解该参数如何起到协助 BGP 检测和避免环路的作用。

Router A Current configuration: hostname RouterA ! interface Serial1 ip address 10.2.2.2 255.0.0.0 ! interface Loopback0 ip address 10.160.20.11 255.255.0.0 ! router bgp 100 network 10.160.20.0 !--- Router A advertises network 10.160.20.0/16. neighbor 10.2.2.1 remote-as 300 ! end Router B Current configuration: hostname RouterB ! interface Serial0 ip address 10.3.3.3 255.0.0.0 ! interface Loopback0 ip address 10.160.10.1 255.255.0.0 ! router bgp 200 network 10.160.10.0 !--- Router B advertises network 10.160.10.0/16. neighbor 10.3.3.1 remote-as 300 ! end 路由器 C Current configuration: hostname RouterC ! interface Serial0 ip address 10.2.2.1 255.0.0.0 ! interface Serial1 ip address 10.3.3.1 255.0.0.0 ! interface Serial2 ip address 10.4.4.1 255.0.0.0 ! router bgp 300 neighbor 10.2.2.2 remote-as 100 neighbor 10.3.3.3 remote-as 200 neighbor 10.4.4.4 remote-as 400 aggregate-address 10.160.0.0 255.0.0.0 summary-only !--- The network is summarized, and Router C only !--- advertises 10.160.0.0/8. ! end 路由器D Current configuration: hostname RouterD ! interface Serial0 ip address 10.4.4.4 255.0.0.0 ! router bgp 400 neighbor 10.4.4.1 remote-as 300 ! end

路由器 C (AS-300) 分别将来自 AS-100 和 AS-200 的路由 10.160.20.0/16 和 10.160.10.0/16 进行聚合。此操作发生是因为您已配置 summary-only 路由器C上的参数。路由器C仅向路由器D通告聚合10.160.0.0/8。聚合10.160.0.0/8是无类域间路由(CIDR)路由。更具体的 10.160.10.0/16 和 10.160.20.0/16 路由已被抑制,因为路由器 C 上的该 BGP 表显示:

RouterC# show ip bgp BGP table version is 6, local router ID is 10.4.4.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.160.0.0/8 0.0.0.0 32768 i s> 10.160.10.0 10.3.3.3 0 0 200 i s> 10.160.20.0 10.2.2.2 0 0 100 i

这是路由器 D 的 BGP 表。注意聚合路由的路径信息:

RouterD# show ip bgp BGP table version is 6, local router ID is 10.4.4.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.160.0.0/8 10.4.4.1 0 300 i

聚合路由 10.160.0.0/8 被视为源自具有源代码 IGP 的 AS-300。该路由已丢失独立前缀 10.160.10.0/16(来自 AS-200)和 10.160.20.0/16(来自 AS-100)的所有具体的 AS_PATH 信息。

与  as-set  参数

现在配置 as-set 中的参数 aggregate-address 命令。以下是新配置:

路由器 C Current configuration: hostname RouterC ! interface Serial0 ip address 10.2.2.1 255.0.0.0 ! interface Serial1 ip address 10.3.3.1 255.0.0.0 ! interface Serial2 ip address 10.4.4.1 255.0.0.0 ! router bgp 300 neighbor 10.2.2.2 remote-as 100 neighbor 10.3.3.3 remote-as 200 neighbor 10.4.4.4 remote-as 400 aggregate-address 10.160.0.0 255.0.0.0 summary-only as-set !--- With the as-set configuration command, the aggregate !--- inherits the attributes of the more-specific routes. ! end

查看此参数如何影响 show ip bgp 路由器上的输出:

RouterD# show ip bgp BGP table version is 2, local router ID is 10.4.4.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.160.0.0/8 10.4.4.1 0 300 {200,100} i

使用 as-set 参数,BGP表中聚合路由的路径信息更改为包含来自300 {200,100}的集。此集合表明该聚合实际汇总了已经过 AS-200 和 AS-100 的路由。此 as-set 在避免路由环路方面,信息非常重要,因为信息会记录路由的位置。

在任何封闭网络中,此汇聚信息通过BGP传播并返回到 as-set 列表。这种传播为环路创造了可能性。BGP的环路检测行为会记录其自身的AS编号 as-set 丢弃聚合更新。此操作可防止形成环路。

注: as-set参数包含有关聚合汇总的每个路由的信息。独立路由发生变化会导致聚合进行更新。在本示例中,如果10.160.10.0/16断开,聚合的路径信息将从300 {200,100}更改为300 {200}。聚合会相应进行更新。如果该聚合汇总了数十或数百条路由且形成该聚合的路由出现了问题,则可能会经常出现翻动现象。

更改聚合路由的属性

此 与 as-set 参数 部分说明如何使用 as-set  保存具有特定路由的AS_PATH属性。某些情况下,您可能需要对聚合路由的属性进行更改。例如,这些属性包括 metric、community 和 origin。

影响

本节介绍如何使用 attribute-map 用于操纵的参数 aggregate-address  attributes.在这种情况下,您可使用以下命令配置一个或多个特定汇聚路由: no-export 社区属性.路由器A设置社区属性 no-export  连接到网络10.160.20.0/16,并向路由器C通告该网络。此部分显示了配置。路由器C继承社区属性 no-export 而路由器会聚合10.160.0.8。因此,不会向路由器 D 通告 10.160.0.0/8。路由器 B、C 和 D 的配置不变。以下是路由器 A 的新配置:

Router A Current configuration: hostname RouterA ! interface Serial1 ip address 10.2.2.2 255.0.0.0 ! router bgp 100 network 10.160.20.0 !--- Router A advertises network 10.160.20.0/16. neighbor 10.2.2.1 remote-as 300 neighbor 10.2.2.1 send-community neighbor 10.2.2.1 route-map SET_NO_EXPORT out ! access-list 1 permit 10.160.20.0 0.0.255.255 route-map SET_NO_EXPORT permit 10 match ip address 1 set community no-export !--- This sets the community attribute no-export. at Router A for route 10.160.20.0/16 ! end

以下是路由器 C 对应于 10.160.0.0/8 的 BGP 表:

RouterC# show ip bgp 10.160.0.0 BGP routing table entry for 10.160.0.0/8, version 9 Paths: (1 available, best #1, not advertised to EBGP peer) Not advertised to any peer {200,100}, (aggregated by 300 10.4.4.1) 0.0.0.0 from 0.0.0.0 (10.4.4.1) Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic- aggregate, best, ref 2 Community: no-export

社区 no-export 停止路由器C通告到eBGP对等体路由器D的聚合路由。路由器D显示它尚未从路由器C获知10.160.0.0:

RouterD# show ip bgp 10.160.0.0 % Network not in table

您可以配置  attribute-map  参数,以控制来自的聚合路由的团体属性  no-export  到  none.  使用此配置可以向路由器 D 通告聚合。

路由器 C Current configuration: hostname RouterC ! interface Serial0 ip address 10.2.2.1 255.0.0.0 ! interface Serial1 ip address 10.3.3.1 255.0.0.0 ! interface Serial2 ip address 10.4.4.1 255.0.0.0 ! router bgp 300 neighbor 10.2.2.2 remote-as 100 neighbor 10.3.3.3 remote-as 200 neighbor 10.4.4.4 remote-as 400 aggregate-address 10.160.0.0 255.0.0.0 as-set summary-only attribute-map Map !--- Use of the attribute-map argument allows !--- you to change the community of the aggregate. ! route-map Map permit 10 set community none !--- This sets the community of the aggregate to none. end

现在,看看路由器 C 对应于 10.160.0.0/8 的 BGP 表。由于该聚合路由没有团队设置,路由器 C 会向路由器 D 通告 10.160.0.0/8。

RouterC# show ip bgp 10.160.0.0 BGP routing table entry for 10.160.0.0/8, version 6 Paths: (1 available, best #1) Advertised to non peer-group peers: 10.2.2.2 10.3.3.3 10.4.4.4 {200,100}, (aggregated by 300 10.4.4.1) 0.0.0.0 from 0.0.0.0 (10.4.4.1) Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic- aggregate, best, ref 2

此 show ip bgp 160.0.0.0  路由器D的输出显示路由器D已从路由器C获取了聚合路由10.160.0.0/8。

RouterD# show ip bgp 10.160.0.0 BGP routing table entry for 10.160.0.0/8, version 10 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 300 {200,100}, (aggregated by 300 10.4.4.1) 10.4.4.1 from 10.4.4.1 (10.4.4.1) Origin IGP, localpref 100, valid, external, best 使用  advertise-map  聚合特定路由的子集

如果您能够控制形成聚合路由的单个前缀,那么您可以更轻松地决定聚合可以承载哪些属性。在更改聚合路由的属性部分的示例中,从聚合路由中排除前缀10.160.20.0。在这种情况下,聚合10.160.0.0/8不继承社区属性 no-export .要进行此更改,请配置 advertise-map  路由器C上的参数。

路由器 C Current configuration: hostname RouterC ! interface Serial0 ip address 10.2.2.1 255.0.0.0 ! interface Serial1 ip address 10.3.3.1 255.0.0.0 ! interface Serial2 ip address 10.4.4.1 255.0.0.0 ! router bgp 300 neighbor 10.2.2.2 remote-as 100 neighbor 10.3.3.3 remote-as 200 neighbor 10.4.4.4 remote-as 400 aggregate-address 10.160.0.0 255.0.0.0 as-set summary-only advertise-map SELECT_SP_ROUTE !--- You exclude a particular prefix with the !--- use of advertise-map. ! access-list 1 permit 10.160.10.0 0.0.255.255 ! route-map SELECT_SP_ROUTE permit 10 match ip address 1 ! end

现在,看看路由器 C 对应于 10.160.0.0/8 的 BGP 表:

RouterC# show ip bgp 10.160.0.0 BGP routing table entry for 10.160.0.0/8, version 15 Paths: (1 available, best #1) Advertised to non peer-group peers: 10.2.2.2 10.4.4.4 200, (aggregated by 300 10.2.2.1) 0.0.0.0 from 0.0.0.0 (10.2.2.1) Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic- aggregate, best, ref 2

只有AS-200是聚合的AS_PATH信息的一部分;AS-100不是信息的一部分。此外,社区没有继承 no-export  从10.160.20.0/16。因此,会向路由器D通告聚合路由。 show ip bgp 160.0.0.0  输出显示通告:

RouterD# show ip bgp 10.160.0.0 BGP routing table entry for 10.160.0.0/8, version 7 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 300 200, (aggregated by 300 10.4.4.1) 10.4.4.1 from 10.4.4.1 (10.4.4.1) Origin IGP, localpref 100, valid, external, atomic-aggregate, best ip bgp 10.160.0.0

注意:由于聚合as-set仅具有AS-200,因此AS-100中的路由器A接受聚合路由并将该路由安装到路由表中。接受此路由是由 BGP 环路检测机制决定的。BGP 环路检测机制不会在 as-set 中探测自己的 AS。

RouterA# show ip bgp BGP table version is 3, local router ID is 10.160.20.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.160.0.0/8 10.2.2.1 0 300 200 i *> 10.160.20.0 0.0.0.0 0 32768 i 使用的影响  suppress-map   使用其他配置命令

此 aggregate-address 命令包括其他配置命令,例如 suppress-map .要了解组合使用所有配置命令的影响,请注意 aggregate-address 仅在您使用 as-set 配置命令.以下属性示例: aggregate-address 可以继承包括 no-export 和 no-advertise .

当您使用 suppress-map 配置命令以及 summary-only 配置命令, summary-only 配置命令没有任何效果。使用 suppress-map 配置命令,更具体的路由 suppress-map 不通告抑制。但是, suppress-map 除汇聚路由外,还通告未覆盖的路由。因此,本节中的说明适用于 suppress-map 使用或不使用 summary-only configuration 命令。

当您使用 as-set 与 suppress-map 但是,尽管不会通告抑制的路由,但聚合路由会继承所有抑制的路由的属性。但您可以使用其他配置命令覆盖继承的属性,例如 attribute-map .更改聚合路由的属性部分描述了 attribute-map .

当您使用 as-set 和 suppress-map 配置命令 advertise-map ,即聚合表单。聚合仅继承中选定的路由中的属性 advertise-map ,无论是 suppress-map 抑制路由。请参阅 使用 advertise-map 聚合特定路由的子集 部分。

当您使用 advertise-map 和 attribute-map 以及 as-set 和其他配置命令, attribute-map 覆盖在 advertise-map .

通常,当您使用 advertise-map ,仅 advertise-map 影响聚合。如果没有 advertise-map ,聚合会继承更具体路由的属性,包括隐含路由和未隐含路由。在这两种情况下,您都可以 attribute-map 配置命令,以覆盖所选属性。

相关信息 BGP:常见问题 BGP 故障排除 BGP 支持页 思科技术支持和下载


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3