BGP Inject Map

image

R1 configuration

interface FastEthernet0/0
 ip address 10.1.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.1.13.1 255.255.255.0
 duplex auto
 speed auto
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 1.1.0.0 mask 255.255.255.0
 network 10.1.13.0 mask 255.255.255.0
 neighbor 10.1.12.2 remote-as 200
 neighbor 10.1.13.3 remote-as 300
 no auto-summary

R2 configuration

interface Loopback0
 ip address 2.2.0.2 255.255.255.0
!
interface Loopback1
 ip address 2.2.1.2 255.255.255.0

interface FastEthernet0/1
 ip address 10.1.12.2 255.255.255.0
 duplex auto
 speed auto
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 2.2.0.0 mask 255.255.255.0
 network 2.2.1.0 mask 255.255.255.0
 aggregate-address 2.2.0.0 255.255.252.0 as-set summary-only
 neighbor 10.1.12.1 remote-as 100
 no auto-summary

R3 configuration

interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 10.1.13.3 255.255.255.0
 duplex auto
 speed auto
!
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 neighbor 10.1.13.1 remote-as 100
 no auto-summary

The setup is very basic R2 generates and aggregate address 2.2.0.0/22 for its two loopback interface lo0 and lo1

The aggregate address is being received by R1 and then advertised to R3

so using inject-map we want to configure R1 to generate more specific routes from this aggregate and advertise to R3

To do this we need to match three things

1- The source that advertises the aggregate route

2- The aggregate route itself

3- The more specific routes

so on R1 we will create three prefix lists

R1(config)# ip prefix-list AGGREGATE_SOURCE permit 10.1.12.2/32
R1(config)#ip prefix-list AGGREGATE  permit 2.2.0.0/22
R1(config)#ip prefix-list UNAGGREGATED permit 2.2.2.0/24

then we will create two route-maps one to match the aggregate source and the aggregate itself and the second one to set the more specific routes

R1(config)#route-map FROM_AGGREGATOR
R1(config-route-map)#match ip address prefix-list AGGREGATE_SOURCE
R1(config-route-map)#match ip address prefix-list  AGGREGATE     

R1(config-route-map)#route-map INJECTED_ROUTES                   
R1(config-route-map)#set ip address prefix-list UNAGGREGATED

so FROM_AGGREGATOR route-map matches these two prefixes 10.1.12.2/32 which is the source of our aggregate and 2.2.0.0/32 which is the aggregate itself

INJECTED_ROUTES set the more specific routes that we need to un-aggregate to R3

Now under the BGP of R1 we need to tie the two route-maps together using the inject-map

R1(config)#router bgp 100
R1(config-router)#bgp inject-map INJECTED_ROUTES exist-map FROM_AGGREGATOR

now let’s see the  BGP of R3

R3(config-router)#do sh ip bgp
BGP table version is 82, local router ID is 10.1.13.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.0.0/22       10.1.13.1                              0 100 200 i
*> 2.2.2.0/24       10.1.13.1                              0 100 ?
r> 10.1.13.0/24     10.1.13.1                0             0 100 i

Nice! it worked we can see that R3 now have the two routes 2.2.0.0/22 and 2.2.2.0/24

what about R2

R2(config)#do sh ip bgp
BGP table version is 15, local router ID is 2.2.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
s> 2.2.0.0/24       0.0.0.0                  0         32768 i
*> 2.2.0.0/22       0.0.0.0                       100  32768 i
s> 2.2.1.0/24       0.0.0.0                  0         32768 i
*> 10.1.13.0/24     10.1.12.1                0             0 100 i

R2 didn’t receive the more specific route from R1

Comments

Popular posts from this blog

BPDU Filter vs BPDU Guard

BGP Weight Attribute

OSPF–Point To Multipoint Non-Broadcast