This will just be a quick blog about BGP Advertise Maps, so imagine you manage AS 200 and you have peers on 2 upstream providers AS 300 and 100. Both 300 and 100 are peering as well. You are also the transit for AS 254.
AS 300 is learning routes from AS 254 both from your AS (200) and AS 300 but because of best-path selection is choosing you as you have a direct connection to AS 254 somewhere in the network. Your task is let AS 300 learn routes from AS 254 via AS 300 instead of your direct connection to AS 300. Yes, its hard to visualize that and I got a diagram to follow later on.
If we check the routing table of the directly connected router of AS300 to your AS(200), you’ll notice its choosing you as the preferred path and has AS 100 as the alternate path.
AS300_AS200#sh ip bgp regex _254$
BGP table version is 21, local router ID is 150.1.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 51.51.51.51/32 155.1.67.6 0 100 200 254 ? <—-Secondary path
*> 155.1.37.3 0 200 254 ? <—Primary path
* 192.10.1.0 155.1.67.6 0 100 200 254 ?
*> 155.1.37.3 0 200 254 ?
* 205.90.31.0 155.1.67.6 0 100 200 254 ?
*> 155.1.37.3 0 200 254 ?
* 220.20.3.0 155.1.67.6 0 100 200 254 ?
*> 155.1.37.3 0 200 254 ?
* 222.22.2.0 155.1.67.6 0 100 200 254 ?
*> 155.1.37.3 0 200 254 ?
Another task is you are only to use this directly connected path, if a link between you and AS 100 goes down. There are multiple connection between you and AS100 but we’ll choose a specific link and that’s the subnet link 155.1.13.0/24.
There is a number of way of doing this but for this blog we’ll use BGP’s advertise maps specifically with the use of non-exist-maps.
Syntax: neighbor x.x.x.x advertise-map <route-map 1> non-exist-map <route-map 2>
route-map 1 would match the path that you are advertising to the neighbor
route-map 2 is the route-map containing the subnet that you are testing if it does not exist, you can start advertising to your neighbor.
Full config from the edge router facing AS 300:
AS200_AS300#:
ip as-path access-list 1 permit _254$
!
route-map EXIST_MAP permit 10
match as-path 1
!
ip prefix-list PL_NON_EXIST_MAP seq 10 permit 155.1.13.0/24
!
route-map NON_EXIST_MAP permit 10
match ip address prefix-list PL_NON_EXIST_MAP
!
router bgp 200
neigh 155.1.37.7 advertise-map EXIST_MAP non-exist-map NON_EXIST_MAP
!
Now if we check on the edge router from AS300#
#sh ip bgp regex _254$
BGP table version is 26, local router ID is 150.1.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 51.51.51.51/32 155.1.67.6 0 100 200 254 ?
*> 192.10.1.0 155.1.67.6 0 100 200 254 ?
*> 205.90.31.0 155.1.67.6 0 100 200 254 ?
*> 220.20.3.0 155.1.67.6 0 100 200 254 ?
*> 222.22.2.0 155.1.67.6 0 100 200 254 ?
We are now just learning the path from AS 100.