In simple network that doesn’t consists of a large numbers of routers, doesn’t relay on more than one routing protocol or doesn’t use BGP you may never come across Route Maps, but if one of above conditions is fullfiled then for sure sooner or later you will have to consider using route maps. What are, when and where use them and how do they work ? Let’s check out.
If I had to explain what are route maps in short I would say they are access lists on the higher level. Why? Because are more granular and sophisticated. In access list we use permit and deny statement, similar to route maps, but there is a difference, in ACL we may only approve or reject something, in route maps we have influence on many information, factors, cause we are allowed to manipulate them. Access lists are being used with route maps only for marking traffic. So what we may do with route maps ? We may manipulate traffic and routing, choose the next hope depending on the source network,we may change BGP attributes, metric for given routes and many more.
Route maps are sometimes compare to programming statement IF … THEN … The construction of route maps is realy simple. Instead of IF we use MATCH and instead of THEN we use SET
route-map ROUTE_MAP permit 10
match ip ACL1, ACL2, ACL3
match interface fa0/1
match metric 10
set next hop 1.1.1.1
As you see we may have many MATCH statements: horizontal (ACL1,ACL2,ACL3) – then the comma means logical OR and vertical then each line means logical AND. Route maps are processed in top-down manner, and processing stops,when the first match is found. Then SET statement is being checked and applied. Of course route map has to be somewhere applied, sometimes to the interface, sometimes to the routing redistribution or to BGP process. So in summary, firstly we have to define conditions to match, secondly we have to definie actions to do and thirdly we have to apply the route map. Let’s check how route maps are useful in real life.
PBR – Policy Based Routing
What is more powerful then routing protocols? Policy Based Routing, even if routing protocols states that given packet, originates from given network has to be sent via interface fa0/0, when we create the route map with statement that the same packet has to be sent via interface fa0/1 it will happen.
access-list 10 permit 192.168.1.0 0.0.0.255 – marking traffic / LAN side
route-map ROUTE_MAP permit 10
match ip address 10 – 10 regarding ACL 10
set ip next hop 1.1.1.1 – send packet via this interface regardless everything
interface fa2/0
ip policy route-map ROUTE_MAP – applying the ROUTE_MAP to the inside interface f2/0
Routing Redistribution
Let’s assume we want to change the metric for specific subnet during redistribution from EIGRP into OSPF protocol owing to routing loops.
Our topology is very simple:
access-list 10 permit 192.168.1.0 0.0.0.255 – marking interesting network
route-map ROUTE_MAP permit 10
match ip address 10 – for specified network in ACL 10
set metric 150 – set metric on 150
redistribute eigrp 1 subnets route-map ROUTE_MAP – applying the ROUTE_MAP to the redistribution process
BGP
When you are talking about route maps in BGP context you think mostly about BGP attributes manipulating.
Let’s try to change WEIGHT attribute. How does it look ?
We have prefix 192.168.1.0/24 in AS2 redistributed by 2 routers to AS1 and for this network we want to change WEIGHT BGP attribute but only for neighbor 20.20.20.20 to 200 when this prefix gets to AS1 from 20.20.20.20. I am not sure if I wrote this clearly so let’s have a look on the network diagram 🙂
So we configure on the router in AS1 :
access-list 10 permit 192.168.1.0 0.0.0.255 – marking interesting prefix
route-map ROUTE_MAP permit 10
match ip address 10 – for specified network in ACL 10
set weight 200 – set weight to 200
router bgp 1
neighbor 20.20.20.20 route-map ROUTE_MAP in – remeber IN not OUT