Tuesday, July 8, 2008

BGP - Conditional Advertisement with non-exist-map

It took me awhile to get this going for some reason but here is the doc that helped me out:

Configuring and Verifying the BGP Conditional Advertisement Feature

Here's my example


Each router is in its own AS.

R1 is advertising to R4.
if this route should fail, then R4 should advertise to R5.
If appears in R4's BGP table, then it should stop advertising

R4 is where the action is so let's have a look:

interface Loopback0
ip address

router bgp 4
no synchronization
bgp log-neighbor-changes
network mask
neighbor remote-as 5
neighbor advertise-map ADV non-exist-map NON
neighbor remote-as 1
no auto-summary
access-list 10 permit
access-list 40 permit
route-map NON permit 10
match ip address 10
route-map ADV permit 10
match ip address 40 is actually the loopback network on R1 so we can test easy by shutting/no shutting the interface. Right now it is up. Let's check the BGP tables on R4 and R5:

R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 0 32768 i
*> 0 0 1 i

R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 0 4 1 i

Now let's shut the interface on R1:

R1(config)#int lo 1

Now check R4 and R5 again:

R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 0 32768 i

R5#debug ip bgp updates
BGP updates debugging is on for address family: IPv4 Unicast
*Mar 1 01:59:35.787: BGP(0): rcvd UPDATE w/ attr: nexthop, origin i, metric 0, path 4
*Mar 1 01:59:35.791: BGP(0): rcvd
*Mar 1 01:59:35.799: BGP(0): Revise route installing 1 of 1 routes for -> to main IP table

R5#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 0 0 4 i


  1. man... i need to know,
    WHAT is the LOGIC behind this feature ??

    if i have a subnet X in my table, do not adv Y to "R",
    if i do not have x in my table, advertise Y.

    you know what i mean, i got the feature, just need to know what i answer when someone aske me, WHY DO WE NEED THIS ??! LOL

  2. Hehe, there are lot of things where I ask myself the same thing :)

    In this case, suppose you had ISPs in different AS. You only want to advertise a route or routes to one of them. Then if your primary connection goes down (identified by the missing route in the non-exist map) you can then advertise the routes to the backup neighbor.

    In some cases this might be better than trying to use AS-prepends to influence path selection because with AS-prepends you only have so much control.

    Hope that helps. If you know any other situations, let me know!

  3. I used a prefiex-list to block the routes in the exist map to enter BGP table, so the route in the exist map in neither BGP table not routing table, but the routes in the advertise map is still NOT sent…
    So my testing result is "not receiving routes in the exist map from any BGP peer/redistribution" , then router will advertise the routes in the ADVERTISE map...

  4. We can take it this way that if there is a customer dual homed to two ISP's for the internet connectivity and dont want the Internet from both the SP's at the same time . Will require this feature to be implemented so that the customer regains connectivity to the internet upon the failure of the primary connection to the SP.

  5. Take another scenario

    Say you have a system A (active) and B for (backup system in different DC) and both reachable via BGP (Private cloud), now remote nodes can use system A as long as it is reachable and while it will use system B in case system A is not responding or not reachable.

    System A BGP-GW can advertise system A subnet only and only if it has internet reachability via different uplink (this is conditional advertisement) otherwise, it will stop advertisement of system A subnet casing all remote nodes to use system B

  6. Yes this is very helpful in Primary and Secondary ISP scenario...

    I have a doubt... what if both ISP are originating default for me? how to track then?

  7. Zahid,

    In case your ISP is giving you default, you can match default via ACL or even Prefix-list.
    More over since we are using route-map, you can match AS-PATH list as well...

    One of the non supported feature of route-map in conditional advertisement is of next-hop.


Note: Only a member of this blog may post a comment.