Procedure
1.
(Optional) Create any prefix lists you will use to select routes for your policy.
2.
Create a route map.
3.
Include
match
statements in your route map to define the selection criteria for routes.
4.
(Optional) Include
set
statements in your route map to modify properties of your routes.
5.
Apply the policy.
Route maps
Route maps are policy tools that are used to match destination prefixes, interfaces, or other route properties.
Optionally, they may change the properties of the route, depending on the match.
The route map includes one or more sequences, each of which contains
match
statements and, optionally,
set
statements. When a route map is applied, its sequences are evaluated in order. If all the
match
statements in a
sequence match the target route, the match succeeds and the route is permitted or denied according to the
permit | deny
instruction in the
route-map
command that defined the sequence; if the sequence contains
set
statements, they are applied to the target route. If any of the
match
statements in the sequence does not
match the target route, the match fails and the next sequence in the route map is evaluated. If all the sequences
fail to match the route, the route is denied.
If the named route map does not already exist, the route-map command creates the
route map
and enters the
route map context. For example:
switch(config)# route-map Map1 permit
switch(route-map-Map1-10)#
At this point, you are ready to enter
match
and
set
commands, described below. When you have finished
entering
match
and
set
commands, an
exit
command exits the route map context and returns to the general
configuration context.
When entering
match
commands, most allow only one command of a given type in a sequence. (For instance,
you can enter
match source-protocol rip
or
match source-protocol ospf
, but not both.) The
exceptions are matching VLAN interfaces and next hops. Multiple
match interface vlan
vid
commands
are concatenated to a single command, and a match succeeds if any of the VLANs matches. For example, the
following two route maps are equivalent:
switch(config)# route-map Map2 permit
switch(route-map-Map2-10)# match interface vlan 11
switch(route-map-Map2-10)# match interface vlan 12
switch(route-map-Map2-10)# match interface vlan 13
switch(route-map-Map2-10)# ex
switch(config)# route-map Map3 permit
switch(route-map-Map3-10)# match interface vlan 11 12 13
switch(route-map-Map3-10)# ex
Similarly, multiple instances of the
match ip next-hop
IP-addr
and
match ipv6 next-hop
IPv6-addr
commands are concatenated internally into single commands, respectively.
The general limitation of only one match command of a given type applies within a sequence. The same type of
match command can be repeated in other sequences in the same route map.
All of the match clauses of the sequence must match for a match to succeed. (For this purpose, multiple
match
interface vlan, match ip next-hop
, and
match ipv6 next-hop
clauses are treated as a single
Chapter 12 Route Policy
275