Skip to content
Feb 23 / Greg

Cisco – Prepending Subset of Your BGP Addressing

Scenario: You have a production site in Dallas and a backup site in, say, College Station(CS). You want the public subnet to failover to CS if the Dallas facility falls off of the earth. What you want to do my friend is prepend.

Prepending is adding your own Autonomous System Number(AS) repeatedly to the beginning of your BGP advertisement to a neighbor. Say if you were to have your addressing hop through three external BGP peers, they would all add their AS number to the as-path attribute. If your AS number is 5 and it goes through AS 10, 20 and then 30 your path would look like “20 10 5” to the routers in AS 30. If you were to prepend 3 times to your as before advertising it to 10, the path would appear as “20 10 5 5 5”. This makes your path for this specific bit of traffic less desirable. Remember that BGP is a path vector protocol, so it prefers the fewest number of AS hops.

So what we will do is make your backup site look so far away with AS prepending that it won’t get used unless the main site is unavailable.

Diagram also available as PDF => [download#5].

bgp prepending

bgp prepending

You can see from the configurations that both routers are in AS 1. subnet lives in the production location. It is advertised from the DR site with it’s AS 1 prepended five times. I used a prefix list to pick out the specific subnet subnet to prepend. I would assume that the DR site would advertise some addressing that isn’t advertised from the production, and thus I don’t want to prepend that addressing. I included the “route-map prepend permit 20” statement in there as a catch-all for the rest of the addressing to be advertised.


leave a comment
  1. Kcjefff / Oct 13 2009


    Just what I was needing.

  2. Greg / Oct 13 2009

    NP, glad I could help 🙂

Leave a Comment