简介
本文档介绍在使用命令时如何操作不同属 aggregate-address 性,以及如何影响传播。
先决条件
要求
Cisco 建议您了解以下主题:
使用的组件
本文档不限于特定的软件和硬件版本。不过,本文档中的配置已经过 Cisco IOS® 软件版本 12.2(28) 测试。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。 
规则
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
背景信息
边界网关协议(BGP)允许使用命令将特定路由聚合到一个路由。当您发出不带任何参数的命令aggregate-address时,不会继承单个路由属性(例如AS_PATH或community),这会导致粒度损失。本文档说明如何在使用命令时操作不同的属 aggregate-address 性,以及如何影响传播。
网络图

不带参数的聚as-set 合
使用该参 as-set 数可创建具有自治系统(AS)数学集的聚合地址。 此参 as-set 数汇总了所有单个路由的AS_PATH属性。使用以下示例配置可以检查此功能,并了解该参数如何起到协助 BGP 检测和避免环路的作用。
| Router A | 
| Current configuration: 
 hostname RouterA 
 ! 
 interface Serial1 
  ip address 2.2.2.2 255.0.0.0 
 !  
interface Loopback0
  ip address 160.20.1.1 255.255.0.0
 !
 router bgp 100 
  network 160.20.0.0 
!--- Router A advertises network 160.20.0.0/16. 
  neighbor 2.2.2.1 remote-as 300 
 ! 
 end | 
| Router B | 
| Current configuration: 
 hostname RouterB 
 ! 
 interface Serial0 
  ip address 3.3.3.3 255.0.0.0 
 ! 
interface Loopback0
  ip address 160.10.1.1 255.255.0.0
 !
 router bgp 200 
  network 160.10.0.0 
!--- Router B advertises network 160.10.0.0/16. 
  neighbor 3.3.3.1 remote-as 300 
 ! 
 end | 
| 路由器 C | 
| Current configuration: 
 hostname RouterC 
 ! 
 interface Serial0 
  ip address 2.2.2.1 255.0.0.0 
 ! 
 interface Serial1 
  ip address 3.3.3.1 255.0.0.0 
 ! 
 interface Serial2 
  ip address 4.4.4.1 255.0.0.0 
 ! 
 router bgp 300 
  neighbor 2.2.2.2 remote-as 100 
  neighbor 2.3.3.3 remote-as 200 
  neighbor 4.4.4.4 remote-as 400 
  aggregate-address 160.0.0.0 255.0.0.0 summary-only  
!--- The network is summarized, and Router C only !--- advertises 160.0.0.0/8.
 ! 
 end
 | 
| 路由器D | 
| Current configuration: 
 hostname RouterD
 ! 
 interface Serial0 
  ip address 4.4.4.4 255.0.0.0 
 ! 
 router bgp 400 
  neighbor 4.4.4.1 remote-as 300                     
 ! 
 end  | 
路由器 C (AS-300) 分别将来自 AS-100 和 AS-200 的路由 160.20.0.0/16 和 160.10.0.0/16 进行聚合。之所以发生此操作,是因为您已在路 summary-only 由器C上配置参数。路由器C仅向路由器D通告聚合160.0.0.0/8。聚合160.0.0.0/8是无类域间路由(CIDR)路由。更具体的 160.10.0.0/16 和 160.20.0.0/16 路由已被抑制,因为路由器 C 上的该 BGP 表显示:
RouterC# show ip bgp 
BGP table version is 6, local router ID is 4.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       3.3.3.3                  0             0 200 i
s> 10.160.20.0       2.2.2.2                  0             0 100 i
这是路由器 D 的 BGP 表。注意聚合路由的路径信息:
RouterD# show ip bgp
BGP table version is 6, local router ID is 4.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
*> 160.0.0.0/8      4.4.4.1                                0 300 i
聚合路由 160.0.0.0/8 被视为源自具有源代码 IGP 的 AS-300。该路由已丢失独立前缀 160.10.0.0/16(来自 AS-200)和 160.20.0.0/16(来自 AS-100)的所有具体的 AS_PATH 信息。
带有参数的聚as-set合
现在在路 as-set 由器C上 aggregate-address 配置命令中的参数。以下是新配置:
| 路由器 C | 
| Current configuration: 
 hostname RouterC 
 ! 
 interface Serial0 
  ip address 2.2.2.1 255.0.0.0 
 ! 
 interface Serial1 
  ip address 3.3.3.1 255.0.0.0 
 ! 
 interface Serial2 
  ip address 4.4.4.1 255.0.0.0 
 ! 
 router bgp 300 
  neighbor 2.2.2.2 remote-as 100 
  neighbor 3.3.3.3 remote-as 200 
  neighbor 4.4.4.4 remote-as 400 
  aggregate-address 160.0.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 4.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
*> 160.0.0.0/8      4.4.4.1                                0 300 {200,100} i使用参 as-set 数,BGP表中聚合路由的路径信息将更改为包含来自300 {200,100}的集合。此集表示聚合实际汇总了通过AS-200和AS-100的路由。由于信息记录路由的位置,因此这些信息在避免路由环路方面变得非常重 as-set 要。
在任何封闭网络中,此汇聚信息通过BGP传播并返回到列出的其中一个 as-set AS。这种传播为环路创造了可能性。BGP的环路检测行为在聚合更新中记下自 as-set 己的AS编号并丢弃聚合。此操作可防止形成环路。
 
注意:as-set 参数包含聚合汇总的每个独立路由的相关信息。独立路由发生变化会导致聚合进行更新。在示例中,如果 160.10.0.0/16 断开,则聚合的路径信息会从 300 {200,100} 变化为 300 {200}。聚合会相应进行更新。如果该聚合汇总了数十或数百条路由且形成该聚合的路由出现了问题,则可能会经常出现翻动现象。
 
更改聚合路由的属性
Aggregate with the  as-setArgument部分显示如何使用 as-set  保存具有特定路由的AS_PATH属性。某些情况下,您可能需要对聚合路由的属性进行更改。例如,这些属性包括 metric、community 和 origin。
影响
本节介绍如何使用参 attribute-map数操作属 aggregate-address  性。在这种情况下,使用社区属性配置一个或多个特定聚 no-export 合路由。路由器A将团体属性设 no-export  置为网络160.20.0.0/16,并将该网络通告给路由器C。此部分显示了配置。路由器C继承社区属性,而路由器聚合 no-export 160.0.0.8。因此,没有向路由器D通告160.0.0.0/8。路由器 B、C 和 D 的配置不变。以下是路由器 A 的新配置:
| Router A | 
| Current configuration: 
 hostname RouterA 
 ! 
 interface Serial1 
  ip address 2.2.2.2 255.0.0.0 
 !  
 router bgp 100 
  network 160.20.0.0 
!--- Router A advertises network 160.20.0.0/16.
  neighbor 2.2.2.1 remote-as 300 
  neighbor 2.2.2.1 send-community 
  neighbor 2.2.2.1 route-map SET_NO_EXPORT out 
 ! 
 access-list 1 permit 160.20.0.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 160.20.0.0/16 ! end | 
以下是路由器 C 对应于 160.0.0.0/8 的 BGP 表:
RouterC# show ip bgp 160.0.0.0
BGP routing table entry for 160.0.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 4.4.4.1)
    0.0.0.0 from 0.0.0.0 (4.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获知160.0.0.0:
RouterD# show ip bgp 160.0.0.0
% Network not in table
您可以在路attribute-map由器C上配置参数,以便从到处理汇聚路由的团体no-export属性none。  使用此配置可以向路由器 D 通告聚合。
| 路由器 C | 
| Current configuration: 
 hostname RouterC 
 ! 
 interface Serial0 
  ip address 2.2.2.1 255.0.0.0 
 ! 
 interface Serial1 
  ip address 3.3.3.1 255.0.0.0 
 ! 
 interface Serial2 
  ip address 4.4.4.1 255.0.0.0 
 ! 
 router bgp 300 
  neighbor 2.2.2.2 remote-as 100 
  neighbor 3.3.3.3 remote-as 200 
  neighbor 4.4.4.4 remote-as 400 
  aggregate-address 160.0.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的BGP表,该表适用于160.0.0.0/8。由于聚合路由没有团体集,因此路由器C会向路由器D通告160.0.0.0/8。
RouterC# show ip bgp 160.0.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:
  2.2.2.2  3.3.3.3  4.4.4.4
  {200,100}, (aggregated by 300 4.4.4.1)
    0.0.0.0 from 0.0.0.0 (4.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获取了聚合路由160.0.0.0/8。
RouterD# show ip bgp 160.0.0.0
BGP routing table entry for 160.0.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 4.4.4.1)
    4.4.4.1 from 4.4.4.1 (4.4.4.1)
      Origin IGP, localpref 100, valid, external, best用于advertise-map聚合特定路由的子集
如果您能够控制形成聚合路由的单个前缀,那么您可以更轻松地决定聚合可以承载哪些属性。在更改聚合路由的属性部分的示例中,从聚合路由中排除前缀160.20.0.0。在这种情况下,聚合160.0.0.0/8不继承社区属 no-export 性。要进行此更改,请在路由器C advertise-map  上配置参数。
| 路由器 C | 
| Current configuration: 
 hostname RouterC 
 ! 
 interface Serial0 
  ip address 2.2.2.1 255.0.0.0 
 ! 
 interface Serial1 
  ip address 3.3.3.1 255.0.0.0 
 ! 
 interface Serial2 
  ip address 4.4.4.1 255.0.0.0 
 ! 
 router bgp 300 
  neighbor 2.2.2.2 remote-as 100 
  neighbor 3.3.3.3 remote-as 200 
  neighbor 4.4.4.4 remote-as 400 
  aggregate-address 160.0.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 160.10.0.0 0.0.255.255 
 ! 
 route-map SELECT_SP_ROUTE permit 10 
  match ip address 1 
 ! 
 end
 | 
现在,看看路由器 C 对应于 160.0.0.0/8 的 BGP 表:
RouterC# show ip bgp 160.0.0.0
BGP routing table entry for 160.0.0.0/8, version 15
Paths: (1 available, best #1)
  Advertised to non peer-group peers:
  2.2.2.2 4.4.4.4
  200, (aggregated by 300 2.2.2.1)
    0.0.0.0 from 0.0.0.0 (2.2.2.1)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-
aggregate, best, ref 2只有 AS-200 是聚合的 AS_PATH 信息的组成部分;AS-100 不是该信息的组成部分。此外,没有从160.20.0.0/16继承 no-export  的团体。因此,会向路由器D通告聚合路由。输出 show ip bgp 160.0.0.0  显示以下通告:
RouterD# show ip bgp 160.0.0.0
BGP routing table entry for 160.0.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 4.4.4.1)
    4.4.4.1 from 4.4.4.1 (4.4.4.1)
      Origin IGP, localpref 100, valid, external, atomic-aggregate, best
ip bgp 160.0.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 160.20.0.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      2.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 ,配置命令没有任何效果。使用configuration命 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 配置命令覆盖所选属性。
相关信息