Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy
RC-226
Cisco IOS XR Routing Configuration Guide
Neighbor Export
The neighbor export attach point selects the BGP routes to se nd to a given peer or group of peers. The
routes are selected by running the set of possible BGP routes t hrough the associated policy. Any routes
that pass the policy are then sent as updates to the peer or group of peers. The routes that are sent may
have had their BGP attributes altered by the policy that has been applied.
The following policy sends all BGP routes to neighbor 10.0.0.5. Routes that are tagged with any
community in the range 2:100 to 2:200 are sent with a MED of 1 00 and a community of 2:666. The rest
of the routes are sent with a MED of 200 and a community of 2:200.
route-policy sample-export
if community matches-any (2:[100-200]) then
set med 100
set community (2:666)
else
set med 200
set community (2:200)
endif
end-policy
router bgp 2
neighbor 10.0.0.5
remote-as 3
address-family ipv4 unicast
route-policy sample-export out
.
.
.
Neighbor Import
The neighbor import attach point controls the reception of rout es from a specific peer. All routes that are
received by a peer are run through the attached policy. Any routes that pass the attached policy are passed
to the BGP Routing Information Base (BRIB) as possible candidates for selection as best path routes.
When a BGP import policy is modified, it is necessary to rerun all the routes that have been received
from that peer against the new policy. The modified policy may now discard routes that w ere previously
allowed through, allow through previously discarded routes, or change the way the routes are modified.
A new configuration option in BGP (bgp auto-policy-soft-reset) that allows this modification to happen
automatically in cases for which either soft reconfiguration is configured or the BGP route-refresh
capability has been negotiated.
The following example shows how to receive routes from neighbor 10.0.0.1. Any routes received with
the community 3:100 have their local preference set to 100 and thei r community tag set to 2:666. All
other routes received from this peer have their local preference set to 200 and their community tag set to
2:200.
route-policy sample_import
if community matches-any (3:100) then
set local-preference 100
set community (2:666)
else
set local-preference 200
set community (2:200)
endif
end-policy