Cisco Systems IOS XR Laptop User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy
RC-227
Cisco IOS XR Routing Configuration Guide
router bgp 2
neighbor 10.0.0.1
remote-as 3
address-family ipv4 unicast
route-policy sample_import in
.
.
.
Network
The network attach point controls the injection of routes from the RIB into BGP. A route policy attached
at this point is able to set any of the valid BGP attributes on the routes that are being injected.
The following example shows a route policy attached at the network attach point that sets the well-known
community no-export for any routes more specific than /24:
route-policy NetworkControl
if destination in (0.0.0.0/0 ge 25) then
set community (no-export) additive
endif
end-policy
router bgp 2
address-family ipv4 unicast
network 172.16.0.5/27 route-policy NetworkControl
Redistribute
The redistribute attach point allows routes from other sources to be advertised by BGP. The policy
attached at this point is able to set any of the valid BGP attributes on the routes that are being
redistributed. Likewise, selection operators allow a user to control what route sources are being
redistributed and which routes from those sources.
The following example shows how to redistribute all routes from OSPF instance 12 into BGP. If OSPF
were carrying a default route, it is dropped. Routes carrying a tag of 10 have their local preference set
to 300 and the community value of 2:666 and no-advertise attached. All other routes have their local
preference set to 200 and a community value of 2:100 set.
route-policy sample_redistribute
if destination in (0.0.0.0/0) then
drop
endif
if tag eq 10 then
set local-preference 300
set community (2:666, no-advertise)
else
set local-preference 200
set community (2:100)
endif
end-policy
router bgp 2
address-family ipv4 unicast
redistribute ospf 12 route-policy sample_redistribute
.
.