Redistribution: Route Maps
Using Route Maps To Change Route Values And Attributes
Distribute-lists are a powerful tool in our route redistribution toolbox – but sometimes we’ll want to do more than simply permit or deny routes to be advertised and redistributed. Sometimes we’ll want to set different metrics for different routes, and maybe even change an OSPF external route type or two – and we’ll do that with route maps.
Let’s take a look at the mechanics of route map operation:
- Route maps are somewhat similar to access-lists.
- They both come to a basic decision of “permit” or “deny”.
- Route lists give us additional power over the data beyond just a simple “transmit” or “don’t transmit”.
- With route maps, we can actually change route attributes.
Route Map Example
1. For source address 22.214.171.124 only, change next hop IP address to 10.1.1.1
R2(config)#access-list 17 permit host 126.96.36.199 R2(config)#route-map ? WORD Route map tag R2(config)#route-map CHANGE_NEXT_HOP ? <0-65535> Sequence to insert to/delete from existing route-map entry deny Route map denies set operations permit Route map permits set operations <cr> R2(config)#route-map CHANGE_NEXT_HOP permit ? <0-65535> Sequence to insert to/delete from existing route-map entry <cr> R2(config)#route-map CHANGE_NEXT_HOP permit 10 R2(config-route-map)#match ip address 17 R2(config-route-map)#set ip next-hop 10.1.1.1
Key Points with Route Map
- The only factor that a standard ACL can match is the source IP address.
- Route map statements can be given a sequence number, and this is a great help when you want to go back to an existing route map and add statements. You do not have to assign a sequence number, and if you don’t, the first statement you enter will be numbered “10” and each statement after that will have a sequence number that increments by 10 from the previous statement.
- The <cr> indicates that this command could be entered just as it is, without a permit or deny statement. If you do not specify permit or deny, a route map statement will default to “permit”.
Example requirement for the use of ‘route maps’
- 188.8.131.52 — Double the default seed metric and set the route to OSPF external type 1.
- 184.108.40.206 – Keep the default seed metric, set the route to OSPF external type 1.
- 220.127.116.11 — Do not redistribute this route at all.
- All future redistributed routes — allow redistribution with the default seed metric and OSPF route type.
1. Identify each network to be filtered using ACLs.
2. Create an overall route map with an intuitive name, such as RIP2OSPF. Using ‘match’ and ‘set’ statements, we work through the requirement a point at a time.
For our 1st requirement, here is what we would need to do:
access-list 2 permit 18.104.22.168 0.0.0.255
route-map RIP2OSPF permit 10
match ip address 2
set metric 40 (20 is the default for redistributed/external OSPF)
set metric-type type-1
Simple as that! 🙂
For our second requirement we will use the same route-map with a different sequence number:
route-map RIP2OSPF permit 20
Same as before, but based on the specific requirement.
Remember also a ‘catchall’ clause is required at the very end of your route map:
route-map RIP2OSPF permit 50 (Last sequence)
Route maps are mainly used in BGP, but can be used with IGPs in the manner.
‘show route-map’ is great for verification your map:
R1#show route-map route-map RIP2OSPF, permit, sequence 10 Match clauses: ip address (access-lists): 2 Set clauses: metric 40 metric-type type-1 Policy routing matches: 0 packets, 0 bytes route-map RIP2OSPF, permit, sequence 20 Match clauses: ip address (access-lists): 22 Set clauses: metric-type type-1 Policy routing matches: 0 packets, 0 bytes route-map RIP2OSPF, deny, sequence 30 Match clauses: ip address (access-lists): 44 Set clauses: Policy routing matches: 0 packets, 0 bytes route-map RIP2OSPF, permit, sequence 40 Match clauses: Set clauses: Policy routing matches: 0 packets, 0 bytes
The next step is to now apply the route-map. 🙂
Example of applying route map for redistribution from RIP into OSPF:
R1(config)#router ospf 1
R1(config-router)#redis rip subnets route-map RIP2OSPF
Or ‘redis rip route-map RIP2OSPF subnets’ either way round will do the job. 🙂