簡介
本文說明如何使用命令操作不同的屬性 aggregate-address
,以及如何影響傳播。
必要條件
需求
思科建議您瞭解以下主題:
採用元件
本文件所述內容不限於特定軟體和硬體版本。但是本檔案中的組態已使用Cisco IOS®軟體版本12.2(28)進行測試。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
慣例
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
背景資訊
邊界閘道通訊協定(BGP)允許使用BGP指令將特定路由聚合到一個路由。當您發出不帶任何引數的命令aggregate-address
時,不會繼承單個路由屬性(如AS_PATH或community),這將導致粒度損失。本文說明使用命令時如何操作不同的屬性 aggregate-address
,以及如何影響傳播。
網路圖表

不帶引數的聚as-set
合
使用該參 as-set
數可建立具有自治系統(AS)數學集的聚合地址。 此參 as-set
數彙總了所有單個路由的AS_PATH屬性。通過這些示例配置,您可以檢查此功能以及該引數如何幫助BGP檢測和避免環路。
路由器 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
|
路由器 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-set
此集表示聚合實際上彙總了通過AS-200和AS-100的路由。此資訊在避免路由環路方面變得很重要,因為資訊記錄路由已經到達的位置。
在任何封閉網路中,此聚合資訊通過BGP傳播並返回到清單的一個 as-set
AS。此傳播可產生回圈的可能性。BGP的環路檢測行為在聚合更新中記下自 as-set
己的AS編號,並丟棄聚合。此操作可防止環路。
附註:as-set引數包含聚合彙總的每個路由的資訊。單個路由的更改會導致聚合的更新。在示例中,如果160.10.0.0/16關閉,聚合的路徑資訊將從300 {200,100}更改為300 {200}。將更新聚合。如果聚合彙總了數十條或數百條路由,並且形成聚合的路由存在問題,則可能會出現持續翻動。
更改聚合路由的屬性
Aggregate with the as-set
Argument部分顯示了如何使用將 as-set
AS_PATH屬性與特定路由一起儲存。在某些情況下,可能需要更改聚合路由的屬性。此類屬性的示例包括度量、社群和原點。
影響
本節介紹如何使用該參 attribute-map
數來操作屬 aggregate-address
性。在這種情況下,您可使用社群屬性配置一個或多個特定聚 no-export
合路由。路由器A將社群屬性設 no-export
置為網路160.20.0.0/16,並將網路通告給路由器C。本節顯示組態。路由器C繼承社群屬性,而路由器聚合了160.0.0.8。因 no-export
此,沒有向路由器D通告160.0.0.0/8。路由器B、C和D的配置沒有變化。以下是路由器A的新組態:
路由器 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不繼承community屬 no-export
性。要進行此更改,請在路由器 advertise-map
C上配置引數。
路由器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
。
-
將configuration命令 suppress-map
與configuration命令配合使 summary-only
用時, summary-only
configuration命令不會有任何效果。使用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
configuration命令覆蓋選定的屬性。
相關資訊