1. 程式人生 > >BGP路由聚合

BGP路由聚合

BGP路由聚合

技術分享圖片
如圖,R1在AS1中,R2,R3,R4在一個大AS100中(R2,R3在AS23中,R4在AS4中),5在AS5中。
BGP路由匯總
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 ?
advertise-map Set condition to advertise attribute
as-confed-set Generate AS confed set path information
as-set Generate AS set path information
attribute-map Set attributes of aggregate
route-map Set parameters of aggregate
summary-only Filter more specific routes from updates
suppress-map Conditionally filter more specific routes from updates
<cr>
直接回車<cr>----默認匯總和默認一起發送
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1#show ip bgp
BGP table version is 33, local router ID is 1.1.1.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
> 200.1.0.0/22 0.0.0.0 32768 i
> 200.1.1.0 0.0.0.0 0 32768 i
> 200.1.2.0 0.0.0.0 0 32768 i
> 200.1.3.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 7, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
*** > 200.1.0.0/22 12.1.1.1 0 0 1 i

200.1.1.0 12.1.1.1 0 0 1 i
200.1.2.0 12.1.1.1 0 0 1 i
200.1.3.0 12.1.1.1 0 0 1 i
只發送匯總路由 summary-only
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 summary-only
R2#show ip bgp
BGP table version is 10, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
* > 200.1.0.0/22 12.1.1.1 0 0 1 i
抑制列表suppress-map--處於抑制列表的路由不允許發送
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 (yidingyaoxie)
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 suppress-map ccie
R1#show run | s bgp
router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 200.1.1.0
network 200.1.2.0
network 200.1.3.0
aggregate-address 200.1.0.0 255.255.252.0 suppress-map ccie
neighbor 12.1.1.2 remote-as 100
no auto-summary
R1#show run | s rout-map
R1#show rou
R1#show route-map
route-map ccie, permit, sequence 10
Match clauses:
ip address (access-lists): 1
Set clauses:
Policy routing matches: 0 packets, 0 bytes
Standard IP access list 1
抓取200.1.1.0 200.1.3.0 的路由,通配符為0.0.2.0 是因為0固定位,1是可變位,只有第23位改變。
10 permit 200.1.1.0, wildcard bits 0.0.2.0 (4 matches)*
R2#show ip bgp
BGP table version is 21, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 0 0 1 i
> 200.1.2.0 12.1.1.1 0 0 1 i
條件列表 advertise-map--處於條件列表中的路由一旦消失,匯總路由就會立即消失
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 advertise-map c1
R1(config)#access-list 2 permit 200.1.2.0
R1(config)#route-map c1 permit 10
R1(config-route-map)#mat
R1(config-route-map)#match ip ad
R1(config-route-map)#match ip address 2
R1(config-route-map)#exit
R1(config)#exit
R1(config)#inter lo 1
R1(config-if)#shutdown
R2#show ip bgp
BGP table version is 26, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 0 0 1 i
> 200.1.2.0 12.1.1.1 0 0 1 i
> 200.1.3.0 12.1.1.1 0 0 1 i
R1#show ip inter b
Interface IP-Address OK? Method Status Protocol
Serial0/0 unassigned YES NVRAM administratively down down
Serial0/1 unassigned YES NVRAM administratively down down
Serial0/2 unassigned YES NVRAM administratively down down
Serial0/3 unassigned YES NVRAM administratively down down
Serial1/0 unassigned YES NVRAM administratively down down
Serial1/1 12.1.1.1 YES NVRAM up up
Serial1/2 unassigned YES NVRAM administratively down down
Serial1/3 unassigned YES NVRAM administratively down down
Loopback0 1.1.1.1 YES NVRAM up up
Loopback1 200.1.1.1 YES manual up up
Loopback2 200.1.2.1 YES manual administratively down down
Loopback3 200.1.3.1 YES manual up up
R2#show ip bgp
BGP table version is 29, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
** > 200.1.1.0 12.1.1.1 0 0 1 i

200.1.3.0 12.1.1.1 0 0 1 i**
attribute-map和route-map一樣,改變路由聚合屬性,並不需要抓取感興趣流量。
R1#show ip bgp
BGP table version is 37, local router ID is 1.1.1.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
> 200.1.1.0 0.0.0.0 0 32768 i
R1#show run | s bgp
router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 200.1.1.0
neighbor 12.1.1.2 remote-as 100
R1(config)#router bgp 1
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 attribute-map c2
R1#show route-map c2
route-map c2, permit, sequence 10
Match clauses:
Set clauses:
metric 888
local-preference 9909
as-path prepend 1 1 no
weight 99
ip next-hop 12.1.1.2
Policy routing matches: 0 packets, 0 bytes
R1#show ip bgp
BGP table version is 39, local router ID is 1.1.1.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
* > 200.1.0.0/22 12.1.1.2 888 9909 99 i*
> 200.1.1.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 39, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 888 0 1 i
> 200.1.1.0 12.1.1.1 0 0 1 i
Route-map改變路由聚合屬性
R1(config)#router bgp 1
R1(config-router)#agg
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 ro
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 route-map c3
R1(config-router)#exit
R1(config)#ro
R1(config)#route-m
R1(config)#route-map c3 per
R1(config)#route-map c3 permit 10
R1(config-route-map)#set lo
R1(config-route-map)#set local-preference 120
R1(config-route-map)#exit
R1(config)#exit
R1#show ip bgp
BGP table version is 44, local router ID is 1.1.1.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
* > 200.1.0.0/22 0.0.0.0 120 32768 i*
> 200.1.1.0 0.0.0.0 0 32768 i
> 200.1.2.0 0.0.0.0 0 32768 i
> 200.1.3.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 10, local router ID is 2.2.2.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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 0.0.0.0 32768 i
s> 200.1.1.0 12.1.1.1 0 0 1 i
s> 200.1.2.0 12.1.1.1 0 0 1 i
s> 200.1.3.0 12.1.1.1 0 0 1 i
R3#show ip bgp
BGP table version is 58, local router ID is 3.3.3.3
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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

>i 1.1.1.1/32 2.2.2.2 0 100 0 1 i
> 5.5.5.5/32 4.4.4.4 0 100 0 (4) 5 i
>i 200.1.0.0/22 2.2.2.2 0 100 0 i
R5#show ip bgp
BGP table version is 50, local router ID is 5.5.5.5
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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
> 200.1.0.0/22 45.1.1.4 0 100 i
As-set攜帶聚合之前路由的屬性
R2#show run | s bgp
router bgp 23
aggregate-address 200.1.0.0 255.255.252.0 as-set
R5#show ip bgp
BGP table version is 4, local router ID is 5.5.5.5
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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
* > 200.1.0.0/22 45.1.1.4 0 100 i*
R5#show ip bgp
BGP table version is 11, local router ID is 5.5.5.5
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,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
* > 200.1.0.0/22 45.1.1.4 0 100 1 i*
> 200.1.1.0 45.1.1.4 0 100 1 i
> 200.1.2.0 45.1.1.4 0 100 1 i
> 200.1.3.0 45.1.1.4 0 100 1 i

BGP路由聚合