Monday 8 December 2014

BGP Maps - Part 1

Today we will look into various maps available in BGP. 

Here is the list which I am aware of

1)Suppress Map
2)Unsuppress Map
3)Advertised Map 
4)Attribute Map/Route Map
5)Exist Map
6)NonExist Map
7)Inject Map
8)Table Map

We will go through each of them one by one. 

1) Suppress MAP:-

 We are going to use the below given topology.




All four routers are in different BGP AS numbers.
R1 = AS 10
R2 = AS 20
R3 = AS 30
R4 = AS 40

R1 has EBGP connection with the remaining three routers. As shown in the diagram, there are two loopbacks configured on R3 and R4 which are advertised in to BGP via "network" command.

If we look at R2's BGP table, we can see that it learns all four loopback IPs with relevant AS paths from R1.



We can use the "aggregate" command to advertise a summary route from R1. Let's use 192.168.0.0/21 and apply the aggregate command on R1.



If we check R2's BGP table, we can see the summary prefix "192.168.0.0/21" along with all the individual prefixes.


If we just want to advertise summary routes, we can use the "summary-only" in the aggregate-address command.


 

Now it only advertises the summary prefix. 

What if we want to advertise the 192.168.2.0/24 and 192.168.4.0/24 prefixes along with the summary and suppress the advertisement of the remaining two loopbacks which are 192.168.1.0/24 and 192.168.3.0/24? In this situation we can use "Suppress-Map".

To use the suppress-map, let's create a prefix-list matching the prefixes we want to suppress.



 we will configure a route-map which matches this prefix-list.



Now, let's apply this route-map as a suppress-map on the aggregate-address command.



If we check R2's BGP table, we can see the summary prefix with two loopbacks as we wanted.



Let's look at the BGP table of R3.



It doesn't show the prefix 192.168.3.0/24 as it's been suppressed by R1. Now what if we want to advertise this prefix to R3 only. This is where we can use the "Unsuppress-Map".

2) Unsuppress Map:-

To advertise the prefix 192.168.3.0/24 to R3, we will first have to create a prefix list on R1 and match it under a route-map.



Now, we have to apply this route-map as an unsuppress-map to the neighbour statement.



Let's check R3's BGP table again.


We can now see the prefix 192.168.3.0/24 has been unsuppressed and visible in R3's BGP table. 

R2's BGP table still does not show the prefixes 192.168.1.0/24 and 192.168.3.0/24.



The main different between suppress map and nonsuppress map is that suppress map is applied with the "aggregate-address" command and nonsuppress map is applied directly to the neighbour statement.

Use of the AS-SET keyword

We will now remove both unsupress-map and suppress-map commands from R1's config. We will only keep aggregate-address on R1 with summary-only keyword so that it can advertise the summary prefix which we can see in the output below.



Notice the AS PATH of the summary prefix. It shows "10 i" which shows that it's originated from R1. It doesn't contain AS number of R3 or R4 even though we are summarizing the prefixes received from AS 30 and 40. 

What if the prefix 192.168.1.0/24 goes down, Router R1 will still keep advertising the summary prefix as long as there is at least one subnet in the BGP table which is part of the summary. 

In this scenario, R3 will still have the summary route installed and will start forwarding packets to R1 which will now be dropped creating a black hole.

To prevent against this, we can specify the keyword "as-set" after the aggregate command keyword.



Now if we check R2



We can see that the summary prefix now shows the AS 30 and 40 along with AS 10. 

As the AS 30 is now visible in the AS Path, BGP loop prevention mechanism will kick in and R3 will not install this summary-route in it's BGP table.



3) Advertised MAP:-

There may be certain situations where you only want to advertise specific AS number in the summary prefix's AS Path. 

So in our topology, let's say we only want to advertise the AS 30 in the summary-prefix. To achieve this, we will match the routes advertised by R3 via a prefix list and match it via a route-map.



We can now apply this route-map to the aggregate-address statement with the keyword "advertised-map".



R2 now shows the summary-prefix with AS 10 and 30. Remember that the attributes such as AS_PATH and Communities can only be included from specific matched prefixes.

4) Attribute Map/Route-Map:-

We will now remove the advertised-map from the aggregate statement and keep advertising the summary with as-set keyword.



At the moment the summary-prefix has the origin code "i". For some reason (e.g. traffic engineering) If we need to change it to incomplete "?", we can use attribute match.

Let's create a route-match and set the origin as incomplete.



We will now apply this route-map on the aggregate-address command with the attribute-map keyword.



We can see that the origin for the aggregated route is now set to incomplete.



Ok, I will replace the word "attribute-map" with "route-map" and see what happens.



If we look at the BGP config section of R1



We can see that the IOS parser automatically changed the route-map to attribute-map. 

We will continue looking into the other maps in the next post.



No comments:

Post a Comment