Redistributing Routes Using Route Maps

Problem

You want to use route maps for more detailed control over how RIP redistributes routing information from other sources.

Solution

Route maps give you much better control over how RIP redistributes external routes. This example uses static routes, but the same principles apply when redistributing routes from other protocols:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4
Router1(config)#ip route 192.168.11.0 255.255.255.0 172.22.1.4
Router1(config)#ip route 192.168.12.0 255.255.255.0 172.22.1.4
Router1(config)#access-list 20 permit 192.168.10.0
Router1(config)#access-list 21 permit 192.168.11.0
Router1(config)#route-map STATIC permit 10
Router1(config-route-map)#match ip address 20
Router1(config-route-map)#set metric 2
Router1(config-route-map)#set tag 2
Router1(config-route-map)#exit 
Router1(config)#route-map STATIC permit 20
Router1(config-route-map)#match ip address 21
Router1(config-route-map)#set metric 8
Router1(config-route-map)#route-map STATIC deny 30
Router1(config-route-map)#exit
Router1(config)#router rip
Router1(config-router)#redistribute static route-map STATIC
Router1(config-router)#exit
Router1(config)#end
Router1#

 

Discussion

In this example, we want RIP to distinguish among the different routes. There are two parameters that we can change, the metric and the route tag. We have already discussed metrics, which basically represent the distance or cost of the path to the remote network. A route tag is simply an arbitrary number that RIP will attach to a particular route. RIP doesn't actually use these tag values, but as we discuss in Recipe 6.17, RIP Version 2 will distribute them with the routing table so you can use this information when distributing these routes into other routing protocols.

The route map in this recipe has three clauses. The first assigns a metric of 2 and a tag of 2 to the network 192.168.10.0. Then it gives a metric of 8 to 192.168.11.0. The last clause discards all other routes. This is different from Recipe 6.3, in which all routes were redistributed with the same metric.

This kind of redistribution is useful when you want to control how traffic load is balanced between two links. For example, if you have two routers that both connect to the same set of remote networks, you could balance them so that one router has a better metric for half of the routes, and the other has a better metric for the rest of the routes. In this way, you can ensure that both links are used equally, and if one router fails, the other will take over for it.

It is often easier to understand route-maps by looking at the show route-map command rather than the configuration commands. In this case, for example, you can see exactly what access lists apply to each clause, along with all of the values that are set as a result. This output also shows how many times each policy has been applied:

Router1#show route-map STATIC
route-map STATIC, permit, sequence 10
 Match clauses:
 ip address (access-lists): 20 
 Set clauses:
 metric 2
 tag 2 
 Policy routing matches: 0 packets, 0 bytes
route-map STATIC, permit, sequence 20
 Match clauses:
 ip address (access-lists): 21 
 Set clauses:
 metric 8
 Policy routing matches: 0 packets, 0 bytes
route-map STATIC, deny, sequence 30
 Match clauses:
 Set clauses:
 Policy routing matches: 0 packets, 0 bytes
Router1#

Looking at the RIP database, you can see the metrics that RIP uses for distributing each of these static routes:

Router1#show ip rip database 
192.168.10.0/24 auto-summary
192.168.10.0/24 redistributed
 [2] via 0.0.0.0, 
192.168.11.0/24 auto-summary
192.168.11.0/24 redistributed
 [8] via 0.0.0.0, 
Router1#

You can also use the route map technique for distributing routes from dynamic routing protocols. For example, if you had another route map called EIGRPMAP that you wanted to use when redistributing routes learned through EIGRP process number 65530, you could configure the router like this:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#router eigrp 65530
Router1(config-router)#network 192.168.1.0
Router1(config-router)#exit
Router1(config)#router rip
Router1(config-router)#redistribute eigrp 65530 route-map EIGRPMAP
Router1(config-router)#end
Router1#

 

See Also

Recipe 6.3; Recipe 6.17





Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net