The following example shows continue clause configuration in a route map sequence.
The first continue clause in route map entry 10 indicates that the route map will go to route map entry 30 if a successful
matches occurs. If a match does not occur, the route map will “fall through” to route map entry 20. If a successful match
occurs in route map entry 20, the set action will be executed and the route map will not evaluate any additional route map
entries. Only the first successful match ip address clause is supported.
If a successful match does not occur in route map entry 20, the route map will fall through to route map entry 30. This sequence
does not contain a match clause, so the set clause will be automatically executed and the continue clause will go to the next
route map entry because a sequence number is not specified.
If there are no successful matches, the route map will fall through to route map entry 30 and execute the set clause. A sequence
number is not specified for the continue clause, so route map entry 40 will be evaluated.
There are two behaviors that can occur when the same
set command is repeated in subsequent continue clause entries. For
set commands that configure an additive or accumulative value (for example,
set
community
additive ,
set
extended
community
additive , and
set
as-path
prepend ), subsequent values are added by subsequent entries. The following example illustrates this behavior. After each set of match
clauses, a
set
as-path
prepend command is configured to add an autonomous system number to the as-path. After a match occurs, the route map stops evaluating
match clauses and starts executing the set clauses, in the order in which they were configured. Depending on the number of
successful match clauses, the as-path is prepended by one, two, or three autonomous system numbers.
route-map ROUTE-MAP-NAME permit 10
match ip address 1
match metric 10
set as-path prepend 10
continue 30
!
route-map ROUTE-MAP-NAME permit 20
match ip address 2
match metric 20
set as-path prepend 10 10
!
route-map ROUTE-MAP-NAME permit 30
set as-path prepend 10 10 10
continue
!
route-map ROUTE-MAP-NAME permit 40
match community 10:1
set local-preference 104
In this example, the same
set command is repeated in subsequent continue clause entries but the behavior is different from the first example. For
set commands that configure an absolute value, the value from the last instance will overwrite the previous value(s). The following
example illustrates this behavior. The set clause value in sequence 20 overwrites the set clause value from sequence 10. The
next hop for prefixes from the 172.16/16 network is set to 10.2.2.2 and not 10.1.1.1.
ip prefix-list 1 permit 172.16.0.0/16
ip prefix-list 2 permit 192.168.1.0/24
route-map RED permit 10
match ip address prefix-list 1
set ip next hop 10.1.1.1
continue 20
exit
route-map RED permit 20
match ip address prefix-list 2
set ip next hop 10.2.2.2
end
Note |
Route maps have a linear behavior, not a nested behavior. Once a route is matched in a route map permit entry with a continue
command clause, it will not be processed by the implicit deny at the end of the route map. The following example illustrates
this case.
|
In the following example, when routes match an AS-path of 10, 20, or 30, the routes are permitted and the continue clause
jumps over the explicit deny clause to process the
match ip address prefix-list command. If a match occurs here, the route metric is set to 100. Only routes that do not match an AS-path of 10, 20, or 30
and do match a community number of 30 are denied. To deny other routes, you must configure an explicit deny statement.
route-map test permit 10
match as-path 10 20 30
continue 30
exit
route-map test deny 20
match community 30
exit
route-map test permit 30
match ip address prefix-list 1
set metric 100
exit