5.5. Configuring Route-map

Overview

Function Introduction

Route-map is used to control and modify routing information. The route-map command allows redistribution of routes. It has a list of match and set commands associated with it. The match commands specify the conditions under which redistribution is allowed, and the set commands specify the particular redistribution actions to be performed if the criteria enforced by match commands are met. Route maps are used for detailed control over route distribution between routing processes. Route maps also allow policy routing, and might route packets to a different route than the obvious shortest path.

If the permit parameter is specified, and the match criteria are met, the route is redistributed as specified by set actions. If the match criteria are not met, the next route map with the same tag is tested. If the deny parameter is specified, and the match criteria are met, the route is not redistributed, and any other route maps with the same map tag are not examined. Routes are checked from line to line looking for a match. If there is no match and the bottom of the route map is reached, then the router denies the route from being redistributed. There is always an implicit deny at the end of a route map.

Specify the sequence parameter to indicate the position a new route map is to have in the list of route maps already configured with the same name.

Principle Description

N/A

Configuration

Configuring Route-map for OSPF

step 1 Enter the configure mode

Switch# configure terminal

step 2 Create route map and set the rule and action

image

The name of route-map is up to 20 characters, in this example the name is “abc”. Two actions “permit” and “deny” are supported; the default action is “permit”. The valid range for sequence number is 1-65535. If the sequence number is not specified when creating first rule of the route-map, system assigns number 10 by default.

Switch(config)# route-map abc permit
Switch(config-route-map)# match metric 20
Switch(config-route-map)# set tag 2
Switch(config-route-map)# exit
Switch(config)# route-map abc permit 20
Switch(config-route-map)# exit

step 3 Enter the router ospf configure mode, redistribute rip routes and apply the route map

Switch(config)# router ospf 100
Switch(config-router)# redistribute rip route-map abc
Switch(config-router)# exit

step 4 Exit the configure mode

Switch(config)# end

step 5 Validation

Switch# show route-map
route-map abc, permit, sequence 10
Match clauses:
metric 20
Set clauses:
tag 2
route-map abc, permit, sequence 20
Match clauses:
Set clauses:

Configuring Route-map for BGP

step 1 Enter the configure mode

Switch# configure terminal

step 2 Create ip access list

Switch(config)# ip access-list acl1
Switch(config-ip-acl)# permit any 3.3.3.0 0.0.0.255 any
Switch(config-ip-acl)# exit

step 3 Create route map to match the access list and set the rule and action

Switch(config)# route-map abc permit
Switch(config-route-map)# match ip address acl1
Switch(config-route-map)# set local-preference 200
Switch(config-route-map)# exit
Switch(config)# route-map abc permit 20
Switch(config-route-map)# exit

step 4 Enter the router bgp configure mode, and apply the route map

Switch(config)# router bgp 1
Switch(config-router)# neighbor 1.1.1.2 remote-as 1
Switch(config-router)# neighbor 1.1.1.2 route-map abc out
Switch(config-router)# network 2.2.2.2/32
Switch(config-router)# network 3.3.3.3/32
Switch(config-router)# exit

step 5 Exit the configure mode

Switch(config)# end

step 6 Validation

Switch# show route-map
route-map abc, permit, sequence 10
Match clauses:
ip address acl1
Set clauses:
local-preference 200
route-map abc, permit, sequence 20
Match clauses:
Set clauses:
Switch# show ip bgp
BGP table version is 6, local router ID is 1.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best,
  i - internal,

S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path

 *>i2.2.2.2/32 1.1.1.1 0 100 0 i
 *>i3.3.3.3/32 1.1.1.1 0 200 0 i

Application cases

N/A