BGP Route Maps



Route Maps


At this point I would like to introduce route maps because they will be used heavily with BGP. In the BGP context, route map is a method used to control and modify routing information. This is done by defining conditions for redistributing routes from one routing protocol to another or controlling routing information when injected in and out of BGP. The format of the route map follows:

route−map map−tag [[permit | deny] | [sequence−number]]

The map−tag is just a name you give to the route−map. Multiple instances of the same route map (same name−tag) can be defined. The sequence number is just an indication of the position a new route map is to have in the list of route maps already configured with the same name.

For example, if I define two instances of the route map, let us call it MYMAP, the first instance will have a sequence−number of 10, and the second will have a sequence number of 20.

route−map MYMAP permit 10
(first set of conditions goes here.)

route−map MYMAP permit 20
(second set of conditions goes here.)

When applying route map MYMAP to incoming or outgoing routes, the first set of conditions will be applied via instance 10. If the first set of conditions is not met then we proceed to a higher instance of the route map. match and set configuration commands. Each route map will consist of a list of match and set configuration.

The match will specify a match criteria and set specifies a set action if the criteria enforced by the match command are met.

For example, I could define a route map that checks outgoing updates and if there is a match for IP address 1.1.1.1 then the metric for that update will be set to 5. The above can be illustrated by the following commands:

match ip address 1.1.1.1
set metric 5

Now, if the match criteria are met and we have a permit then the routes will be redistributed or controlled as specified by the set action and we break out of the list.

If the match criteria are met and we have a deny then the route will not be redistributed or controlled and we break out of the list.

If the match criteria are not met and we have a permit or deny then the next instance of the route map (instance 20 for example) will be checked, and so on until we either break out or finish all the instances of the route map. If we finish the list without a match then the route we are looking at will not be accepted nor forwarded.

One restriction on route maps is that when used for filtering BGP updates (as we will see later) rather than when redistributing between protocols, you can NOT filter on the inbound when using a "match" on the ip address. Filtering on t he outbound is OK.

The related commands for match are:

match as−path
match community
match clns
match interface
match ip address
match ip next−hop
match ip route−source
match metric
match route−type
match tag

The related commands for set are:
set as−path
set clns
set automatic−tag
set community
set interface
set default interface
set ip default next−hop
set level
set local−preference
set metric
set metric−type
set next−hop
set origin
set tag
set weight
Let's look at some route−map examples:




Example 1:

Assume RTA and RTB are running rip; RTA and RTC are running BGP. RTA is getting updates via BGP and redistributing them to rip. If RTA wants to redistribute to RTB routes about 170.10.0.0 with a metric of 2 and all other routes with a metric of 5 then we might use the following configuration:

RTA#
router rip
network 3.0.0.0
network 2.0.0.0
network 150.10.0.0
passive−interface Serial0
redistribute bgp 100 route−map SETMETRIC
router bgp 100
neighbor 2.2.2.3 remote−as 300
network 150.10.0.0
route−map SETMETRIC permit 10
match ip−address 1
set metric 2
route−map SETMETRIC permit 20
set metric 5
access−list 1 permit 170.10.0.0 0.0.255.255
In the above example if a route matches the IP address 170.10.0.0 it will have a metric of 2 and then we break out of the route map list. If there is no match then we go down the route map list which says, set everything else to metric 5. It is always very important to ask the question, what will happen to routes that do not match any of the match statements because they will be dropped by default.

Example 2:

Suppose in the above example we did not want AS100 to accept updates about 170.10.0.0. Since route maps cannot be applied on the inbound when matching based on an ip address, we have to use an outbound route map on RTC:

RTC#
router bgp 300
network 170.10.0.0
neighbor 2.2.2.2 remote−as 100
neighbor 2.2.2.2 route−map STOPUPDATES out
route−map STOPUPDATES permit 10
match ip address 1
access−list 1 deny 170.10.0.0 0.0.255.255
access−list 1 permit 0.0.0.0 255.255.255.255
Now that you feel more comfortable with how to start BGP and how to define a neighbor, let's look at how to start exchanging network information.

There are multiple ways to send network information using BGP. I will go through these methods one by one.