Route Map
*********

Route maps provide a means to both filter and/or apply actions to route, hence allowing policy to be applied to routes.

Route-maps are an ordered list of route-map entries. Each entry may specify up to four distincts sets of clauses:

Matching Policy

     This specifies the policy implied if the Matching Conditions are met or not met, and which actions of the route-map are to be taken, if any. The two possibilities are:

       - permit: If the entry matches, then carry out the Set Actions. Then finish processing the route-map, permitting the route, unless an Exit Action indicates otherwise.

       - deny: If the entry matches, then finish processing the route-map and deny the route (return deny).

     The Matching Policy is specified as part of the command which defines the ordered entry in the route-map. See below.

Matching Conditions

     A route-map entry may, optionally, specify one or more conditions which must be matched if the entry is to be considered further, as governed by the Match Policy. If a route-map entry does not explicitely specify any matching conditions, then it always matches.

Set Actions

     A route-map entry may, optionally, specify one or more Set Actions to set or modify attributes of the route.

Call Action

     Call to another route-map, after any Set Actions have been carried out. If the route-map called returns deny then processing of the route-map finishes and the route is denied, regardless of the Matching Policy or the Exit Policy. If the called route-map returns permit, then Matching Policy and Exit Policy govern further behaviour, as normal.

Exit Policy

     An entry may, optionally, specify an alternative Exit Policy to take if the entry matched, rather than the normal policy of exiting the route-map and permitting the route. The two possibilities are:

       - next: Continue on with processing of the route-map entries.

       - goto N: Jump ahead to the first route-map entry whose order in the route-map is >= N. Jumping to a previous entry is not permitted.

The default action of a route-map, if no entries match, is to deny. I.e. a route-map essentially has as its last entry an empty deny entry, which matches all routes. To change this behaviour, one must specify an empty permit entry as the last entry in the route-map.

To summarise the above:

  Match    No Match
Permit   action   cont
Deny     deny     cont

action

       - Apply set statements

       - If call is present, call given route-map. If that returns a deny, finish processing and return deny.

       - If Exit Policy is next, goto next route-map entry

       - If Exit Policy is goto, goto first entry whose order in the list is >= the given order.

       - Finish processing the route-map and permit the route.

deny

       - The route is denied by the route-map (return deny).

cont

       - goto next route-map entry

Route Map Command
=================

 -- Command: route-map ROUTE-MAP-NAME (permit|deny) ORDER

     Configure the ORDER'th entry in ROUTE-MAP-NAME with Match Policy of either permit or deny.

Route Map Match Command
=======================

 -- Route-map Command: match ip address ACCESS_LIST
     Matches the specified ACCESS_LIST

 -- Route-map Command: match ip next-hop IPV4_ADDR
     Matches the specified IPV4_ADDR.

 -- Route-map Command: match aspath AS_PATH
     Matches the specified AS_PATH.

 -- Route-map Command: match metric METRIC
     Matches the specified METRIC.

 -- Route-map Command: match community COMMUNITY_LIST
     Matches the specified  COMMUNITY_LIST

Route Map Set Command
=====================

 -- Route-map Command: set ip next-hop IPV4_ADDRESS
     Set the BGP nexthop address.

 -- Route-map Command: set local-preference LOCAL_PREF
     Set the BGP local preference.

 -- Route-map Command: set weight WEIGHT
     Set the route's weight.

 -- Route-map Command: set metric METRIC
     Set the BGP attribute MED.

 -- Route-map Command: set as-path prepend AS_PATH
     Set the BGP AS path to prepend.

 -- Route-map Command: set community COMMUNITY
     Set the BGP community attribute.

 -- Route-map Command: set ipv6 next-hop global IPV6_ADDRESS
     Set the BGP-4+ global IPv6 nexthop address.

 -- Route-map Command: set ipv6 next-hop local IPV6_ADDRESS
     Set the BGP-4+ link local IPv6 nexthop address.

Route Map Call Command
======================

 -- Route-map Command: call NAME
     Call route-map NAME. If it returns deny, deny the route and finish processing the route-map.

Route Map Exit Action Command
=============================

 -- Route-map Command: on-match next
 -- Route-map Command: continue
     Proceed on to the next entry in the route-map.

 -- Route-map Command: on-match goto N
 -- Route-map Command: continue N
     Proceed processing the route-map at the first entry whose order is >= N

Route Map Examples
==================

A simple example of a route-map:

     route-map test permit 10
      match ip address 10
      set local-preference 200

This means that if a route matches ip access-list number 10 it's local-preference value is set to 200.

See BGP Configuration Examples for examples of more sophisticated useage of route-maps, including of the call action.