[Contents]
[Prev]
[Next]
[Index]
[Report an Error]
Route Maps
You can use route maps to control and modify routing
information and to define conditions for redistributing routes between
routing domains. You can apply route maps to inbound, outbound, or
redistribution routes. A route map consists of match clauses and set clauses.
Match clauses specify the attribute values that
determine whether a route matches the route map. A route that has
the same attribute values passes the match condition. Routes that
pass all the match conditions match the route map. You issue match commands to define the match conditions for a
route map. You can specify the match conditions in any order. If you
do not specify any match conditions in a route
map, that route map matches all routes.
Set clauses define how the attributes are modified
for matching routes. The set conditions apply only to routes that
pass all the match conditions (or a route map with no match conditions).
When a route passes all the match conditions, the router software
applies all set conditions. You issue set commands to define the set conditions for a route map.
You assign a unique string called the map tag to
identify each route map. You can have multiple instances of a route map, where each instance consists of a different group
of clauses. Each instance is identified by a sequence number. When
you apply a route map, the routing protocol evaluates routes against
the instance of the route map with the lowest sequence number. If
the routes pass all the match conditions specified in the lowest-numbered
instance, and if all set commands are successfully
applied, no other instance of the route map is considered. However,
any routes that do not pass all the match conditions are evaluated
against the next instance of the route map. For example, suppose you
create two instances of route map boston5, one with sequence number
10 and one with sequence number 25. When you apply boston5, routes
are evaluated first against instance 10; any that do not match are
evaluated against instance 25.
When you apply a route map, you specify the permit or deny keyword:
- If you specify the permit keyword,
routes that match the route map are accepted, forwarded, or redistributed.
Routes that do not match the route map are rejected or blocked.
- If you specify the deny keyword,
routes that match the route map are rejected or blocked. Routes that
do not match the route map are accepted, forwarded, or redistributed.
A route map must have at least one match clause
or one set clause. If you have no match clauses, all routes match
the route map, and the set conditions apply to all routes. If you
have no set clauses, no action is taken other than that specified
by the permit or deny keyword.
Route Map Configuration Example
Consider the network structure shown in Figure 1. Suppose you do not want router Boston to
receive any routes that originate in or pass through router Chicago.
Figure 1: Applying Route Maps to Routes

You can use a route map to filter routes based
on the autonomous system (AS) path to accomplish this goal. Use the
following commands to configure router NY:
- host1(config)#router bgp 293
- host1(config-router)#network 192.168.5.0 mask
255.255.255.0
- host1(config-router)#neighbor 10.5.5.2 remote-as
32
- host1(config-router)#neighbor 10.2.2.2 remote-as
873
- host1(config-router)#neighbor 10.2.2.4 remote-as
17
- host1(config-router)#neighbor 10.2.2.4 route-map
block1 out
- host1(config-router)#exit
- host1(config)#ip as-path access-list boston
deny _32_
- host1(config)#route-map block1 deny 1
- host1(config-route-map)#match as-path boston
Multiple Values in a Match Entry
You can specify more than one value in each match
entry of a route map by using any of the following match commands:
match as-path
|
match ipv6 next-hop
|
match community
|
match ipv6 route-source
|
match distance
|
match level
|
match extcommunity-list
|
match metric
|
match ip address
|
match policy-list
|
match ip next-hop
|
match route-type
|
match ipv6 address
|
match tag
|
A clause with multiple values matches a route that
has any of the values; that is, the multiple values are logical ORed.
- host1(config-route-map)#match ip address lisbon
madrid
- host1(config-route-map)#match as-path 10 20
30
You can also issue successive match commands to add new values to a route map entry for any of the commands
listed above.
- host1(config-route-map)#match ip address boston
- host1(config-route-map)#match ip address newyork
This method is equivalent to issuing the following
single command:
- host1(config-route-map)#match ip address boston
newyork
You cannot specify multiple values for the match metric-type command, because it has only two
acceptable values, which are mutually exclusive. Specifying both values
has the same effect as not specifying a metric type at all; specifying
the same value more than once has no meaning.
Negating Match Clauses
If you specify a value when you negate a match command configured in a route map, only that
value for the match entry is deleted. The routing software deletes
the entire match entry only if the entry contains no other values.
In some earlier releases, any value specified with a no match command was ignored, and the entire match
entry was deleted. This change applies to all match commands configured in a route map.
For example, consider the following match entry
to route map miami:
- host1(config)#ip community-list corporate5
permit 32 463 21
- host1(config)#ip community-list dade2 permit
41 53 22
- host1(config)#route-map miami permit 1
- host1(config-route-map)#match community corporate5
dade2
- host1(config-route-map)#exit
- host1(config)#exit
- host1#show route-map
- route-map miami, permit, sequence 10
- Match clauses:
- match community corporate5 dade2
In earlier releases, issuing a command like the
following to remove a community (see Community Lists) not specified in the entry deleted the whole entry, but now nothing
happens:
- host1(config-route-map)#no match community
southbeach
- host1(config-route-map)#exit
- host1(config)#exit
- host1#show route-map
- route-map miami, permit, sequence 10
- Match clauses:
- match community corporate5 dade2
If you instead issue the following commands, the
specified value is deleted:
- host1(config-route-map)#no match community
dade2
- host1(config-route-map)#exit
- host1(config)#exit
- host1#show route-map
- route-map miami, permit, sequence 10
- Match clauses:
- match community corporate5
Issue either of the following commands to delete
the entire match community entry:
- host1(config-route-map)#no match community
- host1(config-route-map)#no match community
corporate5 dade2
Matching a Community List Exactly
You can use the exact-match keyword for the match community command
to specify that a match exists only for the exact community numbers
specified in the community list. The exact-match keyword applies only to a standard community list—that is,
one not specified by a regular expression. You cannot use the exact-match keyword with a community list that is specified
by a regular expression.
Consider the following example:
- host1(config)#ip community-list 1 permit 100
200 300
- host1(config)#exit
- host1#show ip community-list
- Community standard list 1
- permit 0:100 0:200 0:300
- host1(config)#route-map example1 permit 10
- host1(config-route-map)#match community 1
exact-match
- host1(config)#exit
- host1#show route-map example1
- route-map example, permit, sequence 10
- Match clauses:
- community (community-list filter): 1 exact-match
The route map example1 permits
a route only if the route contains community 100 and community 200
and community 300 and no additional communities.
If you do not specify the exact-match option, the route map also permits a match on a route that contains
additional communities. For example, a route that contains communities
100, 200, 300, 400, and 450 matches.
Removing Community Lists from a Route Map
You can use the set comm-list delete command to remove the specified community list from routes matching
the route map, provided that you created the community list with a
single community number per list entry. For example, you cannot remove
the community lists 231:10 and 231:20 with the set comm-list delete command if you created them with
the following command:
- host1(config)#ip community list 1 permit 231:10
231:20
You can, however, remove the lists with the set comm-list delete command if you created them separately
with the following commands:
- host1(config)#ip community list 1 permit 231:10
- host1(config)#ip community list 1 permit 231:20
Matching a Policy List
You can use the match policy-list command to reference a policy list within the route map. Policy
lists are like route maps, but they contain only match clauses and
no set clauses. You can create a policy list to contain a group of
match clauses once, referencing the list in any number of route maps
and avoiding the task of having to reenter the match clauses separately
into each route map.
For more information about creating IP policy lists,
see Match Policy Lists.
Redistributing Access Routes
Access-internal routes, such as DHCP and AAA/PPP
host routes, are host routes to directly connected clients. Access
routes, also known as AAA framed routes, are sourced by AAA.
The following example shows how you might redistribute
access-internal routes and access routes by matching on a tag:
- Configure route map tagtest to match tag 30.
- host1(config)#route-map tagtest
- host1(config-route-map)#match tag 30
- Configure redistribution into BGP of the access-internal
routes and access routes with route map tagtest.
- host1(config)#router bgp 405
- host1(config-router)#redistribute access route-map
tagtest
- host1(config-router)#redistribute access-internal
route-map tagtest
Setting Multicast Bandwidths
You can use the set admission-bandwidth command to set a multicast bandwidth for admission control. Admission
control is performed for the join and mapped interface when the OIF
is added to the mroute.
You can use the set qos-bandwidth command to set a multicast bandwidth for QoS control. The QoS adjustment
is made to the join interface when the OIF is added to the mroute.
 |
Note:
Both the admission bandwidth and QoS bandwidth are a constant
bit rate.
|
For more information about multicast admission
control or QoS adjustment, see Configuring IPv4 Multicast
or chapter Configuring IPv6 Multicast in JUNOSe Multicast Routing Configuration Guide.
match
as-path
- Use to match an AS-path access list.
- The implemented weight is based on the first matched AS
path.
- Example
- host1(config-route-map)#match as-path pathlist5
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match as-path.
match
community
- Use to match a community list.
- This command supports inbound and outbound route maps.
- Example
- host1(config-route-map)#match community comm5
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match community.
match
distance
- Use to match any routes being redistributed out of the
routing table that have the specified administrative distance.
- Distance is used to determine the relative preference
between routes to the same prefix in order to pick the best route
to that prefix in the routing table. Distance has no meaning in any
other circumstance, and any attempt to match distance fails.
- Example
- host1(config-route-map)#match distance 25
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match distance.
match
extcommunity
- Use to match an extended community list in a route map.
- You can specify one or more extended community list names
in a match clause. If you specify more than one extended community
list, the lists are logically ORed.
- Example
- host1(config-route-map)#match extcommunity
topeka10
- Use the no version to remove
the match clause from a route map or a specified value from the match
clause.
- See match extcommunity.
match
ip address
- Use to match any route that has a destination network
number that is permitted by an access list, a prefix list, or a prefix
tree, or that performs policy routing on packets.
- Example
- host1(config-route-map)#match ip address prefix-tree
boston
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match ip address.
match
ip next-hop
- Use to match any routes that have a next-hop router address
passed by the specified access list, prefix list, or prefix tree.
- Example
- host1(config-route-map)#match ip next-hop
5 acl_192_54_24_1
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match ip next-hop.
match
ipv6 address
- Use to match any routes that have a destination network
number address that is permitted by the specified prefix list.
- Example
- host1(config-route-map)#match ipv6 address
prefix-list boston
- Use the no version to delete
all address match clauses from a route map unless you specify a prefix
list, in which case only that prefix list match is removed from the
route map.
- See match ipv6 address.
match
ipv6 next-hop
- Use to match any routes that have a next-hop router address
passed by the specified prefix list.
- Example
- host1(config-route-map)#match ipv6 next-hop
prefix-list next1
- Use the no version to delete
all next-hop match clauses from a route map unless you specify a prefix
list, in which case only that prefix list match is removed from the
route map.
- See match ipv6 next-hop.
match
ipv6 route-source
- Use to match any routes that are advertised from addresses
contained in the specified prefix list.
- Example
- host1(config-route-map)#match ipv6 route-source
prefix-list source
- Use the no version to delete
all route-source match clauses from a route map unless you specify
a prefix list, in which case only that prefix list match is removed
from the route map.
- See match ipv6 route-source.
match
level
- Use to match routes for the specified level.
- Example
- host1(config-route-map)#match level level-1
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match level.
match
metric
- Use to match a route for the specified metric value.
- Example
- host1(config-route-map)#match metric 10
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match metric.
match
metric-type
- Use to match a route for the specified metric type.
- Example
- host1(config-route-map)#match metric-type
external
- Use the no version to delete
the match clause from a route map.
- See match metric-type.
match
policy-list
- Use to reference a policy list that has the specified
name.
- Example
- host1(config-route-map)#match policy-list
list1
- Use the no version to remove
the match clause from a route map.
- See match policy-list.
match
route-type
- Use to match a route for the specified route type.
- Example
- host1(config-route-map)#match route-type level-1
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match route-type.
match-set
summary prefix-tree
- Use to specify the prefix tree that summarizes routes
for a particular route map.
- Use the ip prefix-tree command
to set the conditions of the prefix tree, including which routes to
summarize and how many bits of the network address to preserve.
- Example
- host1(config-route-map)#match-set summary
prefix-tree boston
- Use the no version to disable
the use of the prefix tree by the route map.
- See match-set summary prefix-tree.
match
tag
- Use to match the tag value of the destination routing
protocol.
- Example
- host1(config)#route-map 1
- host1(config-route-map)#match tag 25
- Use the no version to delete
the match clause from a route map or a specified value from the match
clause.
- See match tag.
route-map
- Use to define the conditions for redistributing routes
from one routing protocol to another, and for filtering or modifying
updates sent to or received from peers.
- Each route-map command has
a list of match and set commands associated
with it. That is, the route map itself consists of a set of clauses;
each clause (also called an entry) consists of a match or set command:
- match commands specify the
match criteria, the conditions under which redistribution is allowed
for the current route map.
- set commands specify the set
actions, the redistribution actions to perform if the criteria enforced
by the match commands is met.
- You can specify match and set clauses to modify attributes
of redistributed routes.
- Use route maps when you want to have detailed control
over how routes are redistributed between routing processes.
- You specify the destination routing protocol with the router command.
- You specify the source routing protocol with the redistribute command.
- Example
- host1(config)#route-map nyc1 permit 10
- host1(config-route-map)#match ip address list1
- host1(config-route-map)#set metric-type internal
- Use the no version to delete
the route map.
- See route-map.
set
as-path prepend
- Use to modify an AS path for BGP routes by prepending
one or more AS numbers or a list of AS numbers to the path list.
- The only global BGP metric available to influence the
best path selection is the AS path length. By varying the length of
the AS path, a BGP device can influence the best path selection by
a peer farther away.
- Example
- host1(config-route-map)#set as-path prepend
list list10
- Use the no version to delete
the set clause from a route map.
- See set as-path prepend.
set
automatic-tag
- Use to automatically compute the tag value of the destination
routing protocol.
- Example
- host1(config-route-map)#set automatic-tag
- Use the no version to delete
the set clause from a route map.
- See set automatic-tag.
set
comm-list delete
- Use to remove communities specified by the community list
from the community attribute of routes that match the route map.
- You can use this command to delete communities only if
the community list was created with a single community per list entry,
as the following sample configuration for router host1 shows:
- host1(config)#ip community-list 1 permit 231:10
- host1(config)#ip community-list 1 permit 231:20
- host1(config)#router bgp 45
- host1(config-router)#neighbor 10.6.2.5 remote-as
5
- host1(config-router)#neighbor 10.6.2.5 route-map
indelete in
- host1(config-router)#route-map indelete permit
10
- host1(config-route-map)#set comm-list 1 delete
Router host1 receives the same route
from 10.6.2.5 and applies the indelete route map. BGP compares each
list entry with the community attribute. A match is found for
the list entry 231:10, and this community is deleted from the community
attribute. Similarly, a match is found for the list entry of 231:20,
and this community is deleted from the community attribute.
- Example
- host1(config-route-map)#set comm-list 1 delete
- Use the no version to delete
the set clause from a route map.
- See set comm-list delete.
set
community
- Use to set the community attribute in BGP updates.
- You can specify a community list number in the range 1–4294967295,
or in the new community format of AA:NN, or one of the following well-known
communities:
- local-asr—Prevents advertisement
outside the local AS
- no-advertise—Prevents
advertisement to any peer
- no-export—Prevents advertisement
beyond the BGP confederation boundary
- Alternatively, you can use the list keyword to specify the name of a community list that you previously
created with the ip community-list command.
- Example
- host1(config-route-map)#set community no-advertise
- Use the none keyword to remove
the community attribute from a route.
- Use the no version to delete
the set clause from a route map.
- See set community.
set
dampening
- Use to enable BGP route flap dampening only on routes
that pass the match clauses of, and are redistributed by, a particular
route map.
- BGP creates a dampening parameter block for each unique
set of dampening parameters—such as suppress threshold, reuse
threshold, and so on—used by BGP. For example, if you have a
route map that sets the dampening parameters to one set of values
for some routes and to another set of values for the remaining routes,
BGP uses and stores two dampening parameter blocks, one for each set.
- Example
- host1(config-route-map)#set dampening 5 1000
1500 45 15
- Use the no version to delete
the set clause from a route map.
- See set dampening.
set
distance
- Use to set the administrative distance on routes being
installed into the routing table that match the route map.
- Distance establishes preference between routes to the
same prefix to identify the best route to that prefix. Setting distance
in any other circumstance has no effect.
- Example
- host1(config-route-map)#set distance 5
- Use the no version to delete
the set clause from a route map.
- See set distance.
set
extcommunity
- Use to set the extended community attributes in a route
map for BGP updates.
- You can specify a site-of-origin (soo) extended community and a route target (rt) extended community at the same time in a set clause without overwriting
the other.
- Example
- host1(config-route-map)#set extcommunity rt
10.10.10.2:325
- Use the no version to delete
the set clause from a route map.
- See set extcommunity.
set
ip next-hop
- Use to set the next hop attribute of a route that matches
a route map.
- You can specify an IP address or an interface as the next
hop.
- Use the peer-address keyword
to have the following effect:
- On outbound route maps, disables the next-hop calculation
by setting the next hop to the IP address of the BGP device
- On inbound route maps, overrides any third-party next-hop
configuration by setting the next hop to the IP address of the peer
- Example
- host1(config-route-map)#set ip next-hop 192.56.32.1
- Use the no version to delete
the set clause from a route map.
- See set ip next-hop.
set
ipv6 next-hop
- Use to set the next hop attribute of a route that matches
a route map.
- You can specify an IPv6 address or an interface as the
next hop.
- Example
- host1(config-route-map)#set ipv6 next-hop
1::1
- Use the no version to delete
the set clause from a route map.
- See set ipv6 next-hop.
set
level
- Use to specify where to import routes when all of a route
map's match criteria are met.
- Example
- host1(config-route-map)#set level level-2
- Use the no version to delete
the set clause from a route map.
- See set level.
set
local-preference
- Use to specify a preference value for the AS path.
- Example
- host1(config-route-map)#set local-preference
200
- Use the no version to delete
the set clause from a route map.
- See set local-preference.
set
metric
- Use to set the metric value (for BGP, the MED) for a route.
- To establish an absolute metric, do not enter a plus or
minus sign before the metric value.
- Example
- host1(config-route-map)#set metric 10
- To establish a relative metric, specify a plus or minus
sign immediately preceding the metric value. The value is added to
or subtracted from the metric of any routes matching the route map.
The relative metric value range is 0–4294967295.
- Example
- host1(config-route-map)#set metric -25
- You cannot use both an absolute metric and a relative
metric within the same route map sequence. Setting either metric overrides
any previously configured value.
- Use the no version to delete
the set clause from a route map.
- See set metric.
set
metric-type
- Use to set the metric type for a route.
- For BGP, this command affects BGP behavior only in outbound
route maps and has no effect on other types of route maps. If the
route map contains both a set metric-type and a set metric clause, the set metric clause takes precedence.
If you specify the internal metric type
in a BGP outbound route map, BGP sets the MED of the advertised routes
to the IGP cost of the next hop of the advertised route. If the cost
of the next hop changes, BGP is not forced to readvertise the route.
- For BGP, you can specify the following metrics:
- external—Reverts to
the normal BGP rules for propagating the MED; this is the BGP default
- internal—Sets the MED
of a received route that is being propagated to an external peer equal
to the IGP cost of the indirect next hop
- For IS-IS, you can specify the following metrics:
- external—Considers only
the metric of the route itself is considered for comparison
- internal—Considers both
the metric of the route and the cost to the router that advertised
the route are considered for comparison; this is the IS-IS default
- For OSPF, you can specify the following metrics:
- 1—Sets the cost of the
external routes so that it is equal to the sum of all internal costs
and the external cost
- 2—Sets the cost of the
external routes so that it is equal to the external cost alone; this
is the OSPF default
- Example
- host1(config-route-map)#set metric-type internal
- Use the no version to delete
the set clause from a route map.
- See set metric-type.
set
origin
- Use to set the BGP origin of the advertised route.
- Example
- host1(config-route-map)#set origin egp
- Use the no version to delete
the set clause from a route map.
- See set origin.
set
route-class
- Use to set the route class value. The route-class attribute
enables you to associate a route class with incoming packets based
on the destination or source address of the packet. For example, you
can associate different route classes with different VPN services,
while using the route classes to classify packets for quality of service
(QoS).
- Example
- host1(config-route-map)#set route-class 50
- Use the no version to delete
the set clause from a route map.
- See set route-class.
set
route-type
- Use to set the routes of the specified type (internal,
internal-intra, internal-inter, or external).
- Example
- host1(config-route-map)#set route-type internal
- Use the no version to delete
the set clause from a route map.
- See set route-type.
set
tag
- Use to set the tag value of the destination routing protocol.
- Example
- host1(config-route-map)#set tag 23
- Use the no version to delete
the set clause from a route map.
- See set tag.
set
weight
- Use to specify the BGP weight for the routing table.
- The weights assigned with the set weight command in a route map override the weights assigned using the neighbor weight and neighbor filter-list weight commands.
- Example
- host1(config-route-map)#set weight 200
- Use the no version to delete
the set clause from a route map.
- See set weight.
[Contents]
[Prev]
[Next]
[Index]
[Report an Error]