Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy on CiscoIOS XR Software
RC-377
Cisco IOS XR Routing Configuration Guide
OL-14356-01
The following policy sets dampening values for BGP IPv4 unicast routes. Those routes that are more
specific than a /25 take longer to recover after they have been dampened than routes that are less specific
than /25.
route-policy sample_damp
if destination in (0.0.0.0/0 ge 25) then
set dampening halflife 30 others default
else
set dampening halflife 20 others default
endif
end-policy
router bgp 2
address-family ipv4 unicast
bgp dampening route-policy sample_damp
.
.
.
Default Originate
The default originate attach point allows the default route (0.0.0.0/0) to be conditionally generated and
advertised to a peer, based on the presence of other routes. It accomplishes this configuration by
evaluating the associated policy against routes in the Routing Information Base (RIB). If any routes pass
the policy, the default route is generated and sent to the relevant peer.
The following policy generates and sends a default-route to the BGP neighbor 10.0.0.1 if any routes that
match 10.0.0.0/8 ge 8 le 32 are present in the RIB.
route-policy sample-originate
if rib-has-route in (10.0.0.0/8 ge 8 le 32) then
pass
endif
end-policy
router bgp 2
neighbor 10.0.0.1
remote-as 3
address-family ipv4 unicast
default-originate policy sample-originate
.
.
.
Neighbor Export
The neighbor export attach point selects the BGP routes to send to a given peer or group of peers. The
routes are selected by running the set of possible BGP routes through 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 100 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)