Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

http://www.networklabs.info/2012/03/cisco-route-maps.html

One of the main purposes of a route-map in a Cisco router is customize traffic management beyond the boundaries of the routing table, For example create load balancing, or in a different field, applying TAG’s on a routes learned by a routing protocol the structure of the route-map is very simple, it’s a set of rules, each rule has two fields, match and set.For example a route-map used for policy based routing :

Router (config)# route-map TEST permit 10
Router (config-route-map)# match ip address 100
Router (config-route-map)# set ip next-hop 1.1.1.1
Router (config)# route-map TEST permit 20
Router (config-route-map)# match ip address 200
Router (config-route-map)# set ip next-hop 1.1.1.2

In this example I created a route-map named TEST, in case we have a match on access-list “100” change the next-hop to 1.1.1.1
In case we don’t, moving to rule 20, and there in case we have a match on access-list “200” change the next-hop to 1.1.1.2

In this example we can apply the route-map on the LAN interface, and set part of the network to pass through one line and another part through a different one.
This can be done by anything in the ACL, source or destination IP, Protocol, or port.
To make it more clear the ACL and applying the route-map:

Router (config)#access-list 100 permit ip host 192.168.0.50 any
Router (config)#access-list 100 permit gre any any
Router (config)#access-list 100 permit udp any any eq isakmp
Router (config)# interface FastEthernet 0/0
Router (config-if)#ip policy route-map

In other words, access-list 100 will match all packets with the one of the following criteria source of 192.168.0.50, GRE protocol, or ISAKMP (UDP port 500).

And I applied the route-map on the LAN interface, FastEthernet 0/0Another example of using a route-map is applying custom settings to routes learned (or advertised ) by a routing protocol.

For example:

Router (config)# route-map BGP-IN permit 10
Router (config-route-map)# match ip address 100
Router (config-route-map)# set tag 10
Router (config)# route-map BGP-IN permit 20
Router (config-route-map)# set tag 20
Router (config)#router bgp 1
Router (config-router)# neighbor 2.2.2.2 remote-as 2
Router (config-router)# neighbor 2.2.2.2 route-map BGP-IN in

In this example I used a route-map and applied it on a BGP peer 2.2.2.2 (on the incoming routes) ,
the first rule applies tag ’10’ to any route matched in ACL 100 and tag ’20’ to any other ( notice that if no match statement is configured the route-map will match everything)