BGP Route Summarization and Route Injection

Summarize and inject prefixes in BGP

Alt text

Theory

With Route Summarization you can summarize multiple prefixes and advertise them as a aggregrated route.

Instead of advertising three /24 prefixes we can only advertise one /22 prefix. This means we can still reach all /24 prefixes but we only advertise one route instead of three.

If we have configured a aggregated route (/22 in our example) but a peer still wants to have the /24 routes in their routing table we can inject these routes through route injection.

Topology

The lab consists of three routers. R3 has three loopbacks that we will summarize. I use the Nexus9000v image nxos.9.2.4.bin. Alt text

Summary Route

R3

feature bgp

router bgp 300
address-family ipv4 unicast
network 172.16.0.0/24
network 172.16.1.0/24
network 172.16.2.0/24
aggregate-address 172.16.0.0 255.255.252.0 summary-only as-set #summary-only sends only aggregated address and as-set keeps the as-path

neigh 10.2.0.2
 remote-as 200
 address-family ipv4 unicast

Output on R1 shows that we only get the summary-route when we use the summary-only command.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.1.0.2                                       0 200 300 i

Suppress-Map

Suppresses certain prefixes from being advertised. They are still reachable through the summary-route that gets advertised.

I tried it with access-lists in my lab but somehow it did not work as expected so I use prefix-lists which is probably the better choice anyway.


R3

ip prefix-list SUPPRESS2 permit 172.16.2.0/24

route-map SUPPRESS_MAP1 permit 10
    match ip address prefix-list SUPPRESS2 

router bgp 300
address-family ipv4 unicast
aggregate-address 172.16.0.0/22 suppress-map SUPPRESS_MAP1

Output on R2 shows that we suppress the 172.16.0.0/24 and 172.16.2.0/24 network. But both prefixes are still pingable through the /22 aggregated route.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.2.0.1                                       0 300 i
*>e172.16.1.0/24      10.2.0.1                                       0 300 i

Unsuppress-Map

When you configured summary-only on your aggregrated route but you still want that certain peers get all prefixes and not only the summarized route you can unsuppress them for the specific peer.


R3

ip prefix-list PERMITALLPREFIX permit 0.0.0.0/0 le 32 #le 32 means that we allow all routes and not just he default (0.0.0.0) route

route-map PERMITALL permit 10
  match ip address prefix-list PERMITALLPREFIX 

router bgp 300
neigh 10.2.0.2
address-family ipv4 unicast
      unsuppress-map PERMITALL

Output of R2 shows that we get all prefixes now from R3

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.2.0.1                                       0 300 i
*>e172.16.0.0/24      10.2.0.1                                       0 300 i
*>e172.16.1.0/24      10.2.0.1                                       0 300 i
*>e172.16.2.0/24      10.2.0.1                                       0 300 i

Route injection

In this example we get only the summarized route from R3 but we want to inject certain prefixes into the routing table. So we can use inject-map with a route-map that has the prefixes we want to add and another route-map that tells BGP which peer these prefixes depend on.


The output on R2 and R1 shows that we only get the summary route.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.1.0.2                                       0 200 300 i

R2

ip prefix-list ADVERTISE172_16 permit 172.16.2.0/24
ip prefix-list ADVERTISE172_16 permit 172.16.0.0/22

ip prefix-list R3_PEER_ADDRESS permit 10.2.0.1/32

route-map ADVERTISE_TO_R1 permit 10
 set ip address prefix-list ADVERTISE172_16

route-map R3_PEER permit 10
 match ip address prefix-list ADVERTISE172_16
 match ip route-source prefix-list R3_PEER_ADDRESS

router bgp 200
address-family ipv4 unicast
inject-map ADVERTISE_TO_R1 exist-map R3_PEER copy-attributes #use copy-attributes to keep the as-path

The output on R2 and R1 now shows that we get the /24 prefix that we injected besides the summary route.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.1.0.2                                       0 200 300 i
*>e172.16.2.0/24      10.1.0.2                                       0 200 300 i

Attribute-Map

You can also send attributes along with your summary route.

In this example we set the Multi-Exit-Discriminator to 10 to make our summary route less preferred. This is useful when you have two paths and you want to influence your direct peers that they should take the other path.


R3

route-map MED10 permit 10
set metric 10
aggregate-address 172.16.0.0/22 as-set summary-only attribute-map MED10

Output on R2 shows that we advertise the summary route with a MED of 10.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.2.0.1                10                     0 300 i

Output on R1 shows that the Metric does not get advertised cause R1 does not peer directly with R3.

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e172.16.0.0/22      10.1.0.2                                       0 200 300 i

Thanks for reading my article. If you have any questions or recommendations you can message me via arvednetblog@gmail.com.