Menu

Cisco: Route-maps

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/0

Another 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)

this should cover basic route-map configuration


Hope this post was helpful, If it was please consider a donation:
BTC Address: 1CnyMpjd1RntRDxSus2hu2aDMyzL4Kj29N

LTC Address: LUqrKbzGihTU2GEnL3EwsuuLHCsxCJMdtR

10 comments:

  1. But can you use one route map on multiple vlan interfaces, with the route-mail setting next hop and the match pointing to an ACL selecting traffic from both vlan interfaces?

    ReplyDelete
    Replies
    1. Sure, you can use the same Route-map on as many interfaces as you wish.
      If you want you can match traffic of both interfaces or even creating a route-map with no 'Match' statement and it will be match all.

      Delete
  2. Thanx very clear concept

    ReplyDelete
  3. Thanks bro. u have explained very clearly.

    ReplyDelete
  4. good example, one confusion though can we apply same route-map policy to multiple interfaces

    ReplyDelete
  5. hi , can we apply route-map to vlan interfaces

    ReplyDelete