You can use the exist-map keyword with the neighbor advertise-map command to advertise a route only when the routing table contains some other particular route.
In the network shown in Figure 11, router 2 (R2) has established BGP sessions with both router 1 (R1) and router 3 (R3). The plan is for router 2 to send router 1 an advertisement for the route to prefix 10.10.20.0/24 only if router 2 has received a route to prefix 172.24.19.0/24 from router 3.
Alternatively, if the route to prefix 172.24.20.0 has been installed in the BGP routing table on router 2, then router 2 advertises to router 1 the route to prefix 10.10.30.0. In this case, the route does not have to be learned from router 3.
Figure 18: Advertising a Route When Another Route is Present

The following commands represent a partial configuration of router R2:
- host1(config)#router bgp 200
- host1(config-router)#address-family ipv4 unicast
- host1(config-router-af)#neighbor 10.2.0.1
remote-as 100
- host1(config-router-af)#neighbor 10.2.0.1
advertise-map advertisetoR1 exist-map
trigger1 sequence 10
- host1(config-router-af)#neighbor 10.2.0.1
advertise-map alternatetoR1 exist-map trigger2
- host1(config-router-af)#exit
- host1(config-router)#exit
- !
- !Configure route map to send one route to R1
- !
- host1(config)#access-list 77 permit 10.10.20.0
0.0.0.255
- host1(config)#route-map advertisetoR1 permit
10
- host1(config-route-map)#match ip address 77
- host1(config-route-map)#exit
- !
- !Configure route map to match one trigger route from R3
- !
- host1(config)#ip as-path access-list 1 permit
^300
- host1(config)#access-list 70 permit 172.24.19.0
0.0.0.255
- host1(config)#route-map trigger1 permit 10
- host1(config-route-map)#match ip address 70
- host1(config-route-map)#match as-path 1
- host1(config-route-map)#exit
- !
- !Configure route map to send alternate route to R1
- !
- host1(config)#access-list test permit 10.10.30.0
0.0.0.255
- host1(config)#route-map alternatetoR1 permit
10
- host1(config-route-map)#match ip address test
- host1(config-route-map)#exit
- !
- !Configure route map to match alternate route from R3
- !
- host1(config)#access-list check permit 172.24.20.0
0.0.0.255
- host1(config)#route-map trigger2 permit 10
- host1(config-route-map)#match ip address check
- host1(config-route-map)#exit
The match as-path clause in the route map referenced by the exist-map keyword ensures that router 2 sends router 1 the route to prefix 10.10.20.0 only if a route to 172.24.19.0/24 with an AS path of 300 is present in the BGP routing table. Similarly, you can impose additional restraints by including any other match clause that is supported by an existing outbound policy.
In this configuration, the condition1 route map has a sequence number of ten. Advertise route maps configured for this peer within the same address family and a lower sequence number are processed before the condition1 route map. The condition2 route map has no sequence number configured, thus giving the route map a sequence number of 15 and ensuring that condition2 is processed after the condition1 route map.