Home Blog BGP Conditional Route Injection

BGP Conditional Route Injection

    Rate this post

    BGP Conditional Route Injection

    We have recently posted the BGP Route Aggregation eBook that discusses the benefits of route aggregation and explains the various optional parameters associated with the aggregate-address command. In short, route-aggregation is the process of grouping a large address space into a single address prefix. Instead of announcing more specific individual routes, the aggregate route is advertised. Thanks to this technique the size of the global routing table is reduced.

    As long as there is a component route (the more specific route) in the BGP table, the aggregate route (the less specific route) can be advertised to BGP neighbors. This article, however, focuses on the oppositexf concept –  De-aggregation. This feature allows to reconstruct a component route from a received aggregated prefix and is accomplished by BGP Conditional Route Injection.

    What is BGP Conditional Route Injection?

    Conditional Route Injection is a technique that injects a route based on a condition and the  already existing route. The injected route is usually the more specific (component) route, which is conditionally inserted into the BGP table and advertised to the neighbor. The component route does not have to be in the routing table, instead, it is generated by a router when the injection-map is applied. However, the aggregate route must be present in the BGP table in order to inject the component route into the local BGP table.

    The command for conditional route injection consists of two route-maps.

    router bgp 64500
     bgp inject-map map1 exist-map map2

    The condition here is represented by exist-map. The map contains two statements that should be matched in order to inject a component route. Those are the aggregated prefix and the route-source. The route-source consists of the prefix-list matching the advertising source address of the aggregated route. It is the IP address of a BGP neighbor with the prefix length /32.

    route-map AGGREGATE-EXIST permit 10
     match ip address prefix-list AGGREGATE-ROUTE
     match ip route-source prefix-list NEIGHBOR

    The inject-map contains a sequence matching a single or more injected routes.

    route-map INJECT permit 10
     set ip address prefix-list INJECTED-ROUTE

    BGP Conditional Route Injection Configuration

    Let’s discuss the configuration of the conditional route injection using the network topology depicted in Picture 1. The Customer Edge (CE) router is in AS64500 and has a multi-homed connection to ISP-A (AS64501) and ISP-B (AS64502). ISP-A is configured to advertise the and prefixes as a single aggregate prefix Similarly, the ISP-B router advertises prefixes and as a single aggregated prefix

    Conditional Route Network Topology

    Picture 1: Network Topology

    The CE router has installed the aggregate-route route into its BGP table (Picture 2), with the the best path via a next-hop (ISP-A).
    BGP Table

    Picture 2: BGP Table of CE

    Let’s say that a customer wants to send traffic to and via ISP-A and traffic to and via ISP-B. Sure, he might ask providers to advertise the component routes. However, if such a scenario should be configured locally on a CE router, BGP conditional route injection can be used to install all component routes into the BGP table of the router CE, based on the presence of the received aggregate route

    1. ISP-A Configuration

    interface GigabitEthernet0/0 
     description link to CE 
     Ip address

    Component routes must be presented in a routing table of ISP-A in order to advertise them via eBGP.

    ip route Null0 
    ip route Null0

    For the purpose of demonstration, we will only advertise an aggregate route. Therefore we suppress the advertisement of the component routes with a keyword summary-only.

    irouter bgp 64501 
     network mask 
     network mask 
     aggregate-address summary-only 
     neighbor remote-as 64500

    2.ISP-B Configuration

    interface GigabitEthernet0/01
     description link to CE 
     Ip address
    ip route Null0 
    ip route Null0
    router bgp 64502 
     network mask 
     network mask 
     aggregate-address summary-only 
     neighbor remote-as 64500

    3. CE Configuration

    interface GigabitEthernet0/0 
     description Link to ISP-A 
     ip address 
    interface GigabitEthernet0/1 
     description Link to ISP-B 
     ip address

    First, we will configure BGP and conditional route injection.

    router bgp 64500 
     neighbor remote-as 64501  
     neighbor remote-as 64502
     bgp inject-map INJECT-ISP-A exist-map AGGREGATE-ISP-A 
     bgp inject-map INJECT-ISP-B exist-map AGGREGATE-ISP-B

    3.1 Exist-map

    Now, we need to define both exist-maps. The maps contain prefix-lists matching the aggregate-prefix and the neighbor’s IP address.

    route-map AGGREGATE-ISP-A permit 10 
     match ip address prefix-list AGGREGATE-ROUTE 
     match ip route-source prefix-list ISP-A-IP
    route-map AGGREGATE-ISP-B permit 10 
     match ip address prefix-list AGGREGATE-ROUTE 
     match ip route-source prefix-list ISP-B-IP

    Once we have created the exist-maps we can go further and specify a prefix-list matching the aggregate prefix and two prefix-lists, each matching the neighbor’s IP address.

    ip prefix-list AGGREGATE-ROUTE seq 10 permit
    ip prefix-list ISP-A-IP seq 10 permit
    ip prefix-list ISP-B-IP seq 10 permit

    3.2 Injection-map

    Create an injection-map for each ISP. The maps contain a prefix-list that matches the injected routes. The route-maps set community local-AS that prevents the advertisement of the injected routes outside of AS 64500. It effectively avoids routing loops as the injected routes are not advertised to ISPs.

    route-map INJECT-ISP-A permit 10
     set ip address prefix-list INJECTED-ROUTE-A
     set community local-AS
    route-map INJECT-ISP-B permit 10
     set ip address prefix-list INJECTED-ROUTE-B
     set community local-AS

    The prefix-list INJECTED-ROUTE-A matches the component routes that are injected into the BGP table of CE with the next-hop IP (ISP-A).

    ip prefix-list INJECTED-ROUTE-A seq 10 permit
    ip prefix-list INJECTED-ROUTE-A seq 20 permit

    Similarly, the prefix-list INJECTED-ROUTE-B matches the component routes that are injected into the BGP table of CE with the next-hop IP (ISP-A).

    ip prefix-list INJECTED-ROUTE-B seq 10 permit
    ip prefix-list INJECTED-ROUTE-B seq 20 permit

    4. Verification

    Now let’s inspect the BGP table on the CE router. There is the aggregate-route learned from both ISPs along with the four locally generated injected routes.

    CE# show ip bgp | begin Network

    BGP Table CE Router

    Picture 3: BGP Table of CE

    The injected routes can be checked with the command below.

    CE# show ip bgp injected-paths | begin Network

    Injected Paths

    Picture 4: Checking Injected Paths


    The BGP Conditional Route Injection feature injects more specific prefixes into a BGP routing table over the less specific prefixes that were selected through a normal route aggregation. The outbound traffic can now be routed using the more specific prefixes over individual uplinks. This improves routing accuracy as the more specific routing information is used and we do not need to rely on a single aggregate route.

    Boost BGP Preformance

    Automate BGP Routing optimization with Noction IRP

    BGP Demo


    Leave a Reply