The conditional advertisement feature allows a service provider to advertise certain routes to a preferred subnet under normal operational conditions, while maintaining the ability to move its traffic to an alternative subnet should its preferred routes fail.
The following example configures two static routes on Router 1. One will be advertised to Router 2 under normal operational conditions, the other will only be advertised if the first route no longer exists. A prefix list is created for each static route destination prefix. The destination prefix to be advertised under normal operational conditions is assigned to the non-exist-map route-map. The destination prefix to be advertised only if the advertised prefix fails is assigned to the advertise route-map.
BGP Conditional Advertisement Example Topology presents the conditional advertisement example topology.
For Router 1
Router 1(su)->configure Router 1(su-config)->ip route 1.0.0.0/8 192.168.13.112 interface vlan.0.13 Router 1(su-config)->ip route 2.0.0.0/8 192.168.13.112 interface vlan.0.13 Router 1(su-config)->ip prefix-list adv-list1 permit seq 1 1.0.0.0/8 Router 1(su-config)->route-map bgp adv-map1 Router 1(su-config-route-map-bgp)->match prefix-list adv-list1 Router 1(su-config-route-map-bgp)->exit Router 1(su-config)->ip prefix-list non-exist-list1 permit seq 1 2.0.0.0/8 Router 1(su-config)->route-map bgp non-exist-map1 Router 1(su-config-route-map-bgp)->match prefix-list non-exist-list1 Router 1(su-config-route-map-bgp)->exit Router 1(su-config)->router bgp 10 Router 1(su-config-bgp)->bgp router-id 1.1.1.1 Router 1(su-config-bgp)->neighbor 192.168.12.112 remote-as 10 Router 1(su-config-bgp)->neighbor 192.168.12.112 advertise-map adv-map1 non-exist-map non-exist-map1 Router 1(su-config-bgp)->
For Router 2:
Router 2(su)->configure Router 2(su-config)->ip route 192.168.13.0/24 192.168.12.111 interface vlan.0.12 Router 2(su-config)->router bgp 10 Router 2(su-config-bgp)->bgp router-id 2.2.2.2 Router 2(su-config-bgp)->neighbor 192.168.12.111 remote-as 10 Router 2(su-config-bgp)->Verifying the Configuration
If advertised map configuration is not applied, the Router 1 advertised routes output for 192.168.12.112 would display both configured static routes as being advertised to Router 2:
Router 1(su)->show ip bgp peer 192.168.12.112 advertised-routes Route status codes: adv - advertised, sup - suppressed, pw - pending w/drawal, wd - w/drawn Route aggregation codes: 1 - Route is not aggregating or aggregated 2 - Route is aggregating 3 - Route is unsuppressed aggregated 4 - Route is suppressed aggregated Stat Aggr Network Next Hop Rib MED Local-Pref Origin AS Path adv 1 1.0.0.0 192.168.13.112 U 0 100 Inc adv 1 2.0.0.0 192.168.13.112 U 0 100 Inc
With the advertised map configuration applied, only network 2.0.0.0 displays:
Router 1(su)->show ip bgp peer 192.168.12.112 advertised-routes .... Stat Aggr Network Next Hop Rib MED Local-Pref Origin AS Path adv 1 2.0.0.0 192.168.13.112 U 0 100 Inc
Should static route 2.0.0.0/8 be withdrawn, network 1.0.0.0 is advertised and network 2.0.0.0 displays as withdrawn:
Router 1(su-config)->no ip route 2.0.0.0/8 192.168.13.112 interface vlan.0.13 1 Router 1(su-config)->show ip bgp peer 192.168.12.112 advertised-routes .... Stat Aggr Network Next Hop Rib MED Local-Pref Origin AS Path adv 1 1.0.0.0 192.168.13.112 U 0 100 Inc wd 1 2.0.0.0 192.168.13.112 U 0 100 Inc
Configuring BGP Conditional Route Advertisement describes how to configure BGP conditional route advertisement.
Step | Task | Command(s) |
---|---|---|
1 | In router configuration mode, configure a prefix list for both the advertise and non-exist prefixes to be matched in the appropriate route-maps. | ip prefix-list name [seq seq-value] {deny | permit} {prefix/length} [source-address] [next-hop] [ge length] [le length] [nlri] |
2 | In router configuration mode, create both an advertise and non-exist route-map. | route-map bgp name [permit | deny] [sequence-number] |
3 | In BGP route-map configuration mode, add match statements containing the configured prefix lists to the appropriate BGP route-map. | match prefix-list prefix-list |
4 | In BGP configuration mode, specify the advertise and non-exist maps to be applied to this neighbor. | neighbor {ip-address | groupID} advertise-map adv-map non-exist-map non-exist-map |