Maps of BGP

There are so many different BGP explanations out there and what I wanted to do is gather all the information together about BGP maps and put it all in one post.

Everytime I sit down to BGP I always get confused about the quantity of many different “maps” that can be applied to the configuration.
As far as I’m aware there are 8 different BGP “maps” that we can use and I can never remember which one I should use for a particular task

We have the following :

Route-maps
Suppress-Map
Unsuppress-Map
Inject-Map
Advertise-Map
Attribute-Map
Exist-Map
Non-exist-map

See our below simple topology

BGP Initial Configs : BGP_MAPS_CONFIG

BGP GNS3 NET FILE : NET_FILE

Each router has a Lo0 of X.X.X.X where X is the router number. R4 is our BB1 router !

Let’s start from basic aggregation before we move on to the BGP Maps

AGGREGATE ADDRESS & AGGREGATE ADDRESS SUMMARY ONLY

The default, when aggregating with BGP, is to advertise both the aggregate and all the component routes so :

R1 table before aggregation

R1

let’s aggregate on R3
R3(config-router)#aggregate-address 4.4.0.0 255.255.0.0

R1 table after aggregation

R1

If you want to advertise just the aggregate, you use the summary-only keyword at the end of the aggregate.

R3(config-router)# aggregate-address 4.4.0.0 255.255.0.0 summary-only

and again check R1 table

R1

=========================================================================
=========================================================================
SUPPRESS-MAP

if you want to suppress some, but not all, of the component routes, you use a suppress-map.
let’s modify R3 to restrict BB1 4.4.45.44/32 from being advertised.

R3(config)#ip prefix-list R4LO2 permit 4.4.45.44/32
R3(config-router)#route-map SUPPR4LO2 per 10
R3(config-route-map)#match ip add prefix-list R4LO2
R3(config)#router bgp 300
R3(config-router)#aggregate-address 4.4.0.0 255.255.0.0 suppress-map SUPPR4LO2

and check R1 table
R1

As you can see 4.4.45.44/32 is gone however what if we were asked to advetise this network in addition to the summary route ?

R3(config)#ip prefix-list R4LO2 permit 4.4.45.44/32
R3(config)#route-map SUPPR4LO2 den 10
R3(config-route-map)#match ip add prefix-list R4LO2
R3(config-route-map)#route-map SUPPR4LO2 per 100
R3(config)#router bgp 300
R3(config-router)#aggregate-address 4.4.0.0 255.255.0.0 suppress-map SUPPR4LO2

and back to R1

R1

As you can see we are advertising only the summary route along with 4.4.45.44/32

=========================================================================
=========================================================================

UNSUPPRESS-MAP

If you have let’s say 15 BGP neighbors and want to leak the suppress prefix to only one of them ?

R3(config)#ip prefix-list R4LO2 permit 4.4.45.44/32
R3(config-router)#route-map SUPPR4LO2 per 10
R3(config-route-map)#match ip add prefix-list R4LO2
R3(config)#router bgp 300
R3(config-router)#aggregate-address 4.4.0.0 255.255.0.0 suppress-map SUPPR4LO2
R3(config-router)#neighbor 192.168.23.2 unsuppress-map SUPPR4LO2

As you can see R2 and R1 has got 4.4.45.44/32 network in their BGP tables however R1 is learning about this prefix from R2 and NOT R3

R2

and R1

R1

===================================================================================================
===================================================================================================
===================================================================================================

INJECT-MAP & EXIST-MAP

With conditional route injection we can insert more specific routes into a BGP table based on the existance of another route which means that now we will combine the inject-map with the exist-map. The exist-map determines if the aggregate is present. Let’s go back on R3 to just a summary-only aggregate

R3(config-router)#aggregate-address 4.4.0.0 255.255.0.0 summary-only

Now we will create an (inject-map) to advertise 4.4.45.44 and 4.4.46.44 to R2 based on the existing aggregate (exist-map)

Before let’s check the BGP table on R1

R1

So on R2 :

R2(config)#ip prefix-list AGGR3 seq 5 permit 4.4.0.0/16
R2(config)#ip prefix-list SOURCER3 seq 5 permit 192.168.23.3/32
R2(config)#ip prefix-list SENDTOR1 seq 5 permit 4.4.45.44/32
R2(config)#ip prefix-list SENDTOR1 seq 10 permit 4.4.46.44/32

R2(config)#route-map MUSTEXIST per 10
R2(config-route-map)#match ip add pre AGGR3
R2(config-route-map)#match ip route-source pre SOURCER3

R2(config)#route-map INJECTTHIS permit 10
R2(config-route-map)#set ip address prefix-lists SENDTOR1

R2(config)#router bgp 200
R2(config-router)#bgp inject-map INJECTTHIS exist-map MUSTEXIST

Now let’s check the BGP table on R1
R1

As you can see networks 4.4.45.44/32 and 4.4.46.44/32 have been learned from 192.168.12.2 which is what we expect however if we also check R3 table

R3

Hmm.. This config should not cause a loop but just in case we do not want R3 to learn its own routes back from its neighbors so we can simply on R2 add a keyword “copy-attributes” to this statement

R2(config)#router bgp 200
R2(config-router)#bgp inject-map INJECTTHIS exist-map MUSTEXIST copy-attributes

R3

That way AS-PATH will be included in the advertisement and R3 will not install these routes in its BGP table if it learns them from R2 and R1 in this case , loop prevention.

===================================================================================================
===================================================================================================
===================================================================================================

I’ve run out of time today to finish off this post but will do as soon as I can !

Enjoy !

Tom

 

Source

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s