BGP Conditional Route Advertisement

Assume the following scenario:

asn1

BOB’s network 136.1.29.0/24 resides in AS-300.

For what ever reason, AS-300 needs all traffic to Prefix-A (136.1.29.0/24) to come via ASN-200 only, but in the event of link failure between AS-200 and AS-300 traffic are allowed to come in from AS-100. With the normal BGP attributes you can do this really quickly.

Hypothetically,  lets assume for a second that AS-100 has a weight set, preferring the direct link to AS-300 for all prefixes learned from AS-300.  And AS-100 is not cooperating with your request, nor is  interested to make any changes in their AS. How can you influence AS-100’s  decision, to prefer the route learned via AS-200.

There is a nice and not-so-nice to way to do this.

The not so nice way, and likely the easiest, is to originate two /25,  and not the /24.

Or you can use BGP Conditional Route Advertisement, which offers an alternative way to affect how traffic enters your AS. By conditionally not advertising Prefix-A to a AS-100, AS-100 is forced to route through AS-200. And in the event of link failure,  conditional route advertisement will begin advertising prefix-A to the AS-100. Thus by controlling which prefixes get advertised to which neighbors, traffic can be forced to be routed in the appropriate links.

Conditional Route Advertisement consist of two parts:

> the prefix/s to watch (LINK-300-200)
> the prefix/s to advertise (PREFIX-A)

Before configuring,  confirm that all of the above prefix/s are in the BGP table.

The configuration to accomplish this :

ip prefix-list PREFIX-A permit 136.1.29.0/24
ip prefix-list LINK-300-200 permit 136.1.23.0/24
!
route-map ADV permit
match ip address prefix-list PREFIX-A
!
route-map WATCH permit
match ip address prefix-list LINK-300-200
!
router bgp 300
network 136.1.23.0 mask 255.255.255.0
neighbor 136.1.245.5 advertise-map ADV non-exist-map WATCH

The following shows the status of the advertise-map as WITHDRAW, since the link to AS-200 is up.

R2#sh ip bgp neighbors 136.1.245.5 | i Condition
Condition-map WATCH, Advertise-map ADV, status: Withdraw

As a result, you can see that we are not advertising 136.1.29.0/24 to AS-100.

R2#sh ip bgp neighbors 136.1.245.5 advertised-routes
Network             Next Hop    Metric LocPrf Weight Path
*> 136.1.2.0/24     136.1.23.2          0             0 200 i
*> 136.1.23.0/24    0.0.0.0             0             32768 i

Once the watched prefix (LINK-300-200) leaves the BGP table,  PREFIX-A will be advertised to AS-100. To test this ,  we will bring down the link to  R2. That will remove 136.1.23.0/29 route out of BGP, causing the status of the advertise-map to change to ADVERTISE.

R2#sh ip bgp neighbors 136.1.245.5 | i Condition
Condition-map WATCH, Advertise-map ADV, status: Advertise

If you now look at the routes advertised, you will see 136.1.29.0/24 is being advertised to AS-100

R2#sh ip bgp neighbors 136.1.245.5 advertised-routes
Network             Next Hop     Metric LocPrf Weight Path
*> 136.1.29.0/24    0.0.0.0              0            32768 i

Advertisement

4 thoughts on “BGP Conditional Route Advertisement

  1. Good stuff, little bit difficult @ first. I think it will be more simple if word like BACKUP, PREFER where used when naming your route-maps.

    Thanks for good work Ruhann.

    1. The names used indicates its purpose :)
      The ‘WATCH’ route-map is the route being watched
      The ‘ADV’ route-map is the new route to advertise.

Leave a Reply to Ruhann Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.