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 distinct sets of clauses:
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:
The Matching Policy is specified as part of the command which defines the ordered entry in the route-map. See below.
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:
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 |
Configure the order‘th entry in route-map-name with Match Policy of either permit or deny.
Matches the specified access_list
Matches the specified prefix-list
Matches the specified prefix-len. This is a Zebra specific command.
Matches the specified access_list
Matches the specified prefix-list
Matches the specified prefix-len. This is a Zebra specific command.
Matches the specified ipv4_addr.
Matches the specified as_path.
Matches the specified metric.
Matches the specified tag value associated with the route. This tag value can be in the range of (1-4294967295).
Matches the specified local-preference.
Matches the specified community_list
This is a BGP specific match command. Matches the peer ip address if the neighbor was specified in this manner.
This is a BGP specific match command. Matches the peer ipv6 address if the neighbor was specified in this manner.
This is a BGP specific match command. Matches the peer interface name specified if the neighbor was specified in this manner.
This is a ZEBRA specific match command. Matches the originating protocol specified.
This is a ZEBRA specific match command. The number is a range from (0-255). Matches the originating protocols instance specified.
Set a tag on the matched route. This tag value can be from (1-4294967295). Additionally if you have compiled with the --enable-realms configure option. Tag values from (1-255) are sent to the Linux kernel as a realm value. Then route policy can be applied. See the tc man page.
Set the BGP nexthop address to the specified IPV4_ADDRESS. For both incoming and outgoing route-maps.
Set the BGP nexthop address to the address of the peer. For an incoming route-map this means the ip address of our peer is used. For an outgoing route-map this means the ip address of our self is used to establish the peering with our neighbor.
Set the route-map as unchanged. Pass the route-map through without changing it’s value.
Set the BGP nexthop address to the address of the peer. For an incoming route-map this means the ipv6 address of our peer is used. For an outgoing route-map this means the ip address of our self is used to establish the peering with our neighbor.
For Incoming and Import Route-maps if we receive a v6 global and v6 LL address for the route, then prefer to use the global address as the nexthop.
Set the next-hop to the specified IPV6_ADDRESS for both incoming and outgoing route-maps.
Set the BGP local preference to local_pref.
Set the route’s weight.
Set the BGP attribute MED.
Set the BGP AS path to prepend.
Set the BGP community attribute.
Set the BGP-4+ link local IPv6 nexthop address.
Set BGP route origin.
Call route-map name. If it returns deny, deny the route and finish processing the route-map.
Proceed on to the next entry in the route-map.
Proceed processing the route-map at the first entry whose order is >= N
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 Miscellaneous Configuration Examples for examples of more sophisticated usage of route-maps, including of the call action.