Cisco Systems OL-14356-01 Network Router User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy on Cisco IOS XR Software
RC-379
Cisco IOS XR Routing Configuration Guide
OL-14356-01
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
.
.
Show BGP
The show bgp attach point allows the user to display selected BGP routes that pass the given policy. Any
routes that are not dropped by the attached policy are displayed in a manner similar to the output of the
show bgp command.
In the following example, the show bgp route-policy command is used to display any BGP routes
carrying a MED of 5:
route-policy sample-display
if med eq 5 then
pass
endif
end-policy
!
show bgp route-policy sample-display
A show bgp policy route-policy command also exists, which runs all routes in the RIB past the named
policy as if the RIB were an outbound BGP policy. This command then displays what each route looked
like before it was modified and after it was modified, as shown in the following example:
RP/0/RP0/CPU0:router# show rpl route-policy test2
route-policy test2
if (destination in (10.0.0.0/8 ge 8 le 32)) then
set med 333