Cisco Systems IOS XR Laptop User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy
RC-212
Cisco IOS XR Routing Configuration Guide
route-policy quickstart-drop
drop
end-policy
Ignore routes with specific AS numbers in the path
The following example shows the policy definition in three parts. First, the as-path-set command
defines three regular expressions to match against an AS path. Second, the route-policy command
applies the AS path set to a route. If the AS path attribute of the route matches the regular expression
defined with the as-path-set command, the protocol refuses the route. Third, the route policy is attached
to BGP neighbor 10.0.1.2. BGP consults the policy named ignore_path_as on routes received (imported)
from neighbor 10.0.1.2.
as-path-set ignore_path
ios-regex '_11_',
ios-regex '_22_',
ios-regex '_33_'
end-set
route-policy ignore_path_as
if as-path in ignore_path then
drop
else
pass
endif
end-policy
router bgp 2
neighbor 10.0.1.2 address-family ipv4 unicast policy ignore_path_as in
Set community based on MED
The following example shows how the policy tests the MED of a route and modifies the community
attribute of the route based on the value of the MED. If the MED value is 127, the policy adds the
community 123:456 to the route. If the MED value is 63, the policy adds the value 123:789 to the
community attribute of the route. Otherwise, the policy removes the community 123:123 from the route.
In any case, the policy instructs the protocol to accept the route.
route-policy quickstart-med
if med eq 127 then
set community (123:456) additive
elseif med eq 63 then
set community (123:789) additive
else
delete community in (123:123)
endif
pass
end-policy
Set local preference based on community
The following example shows how the community-set named quickstart-communities defines
community values. The route policy named quickstart-localpref tests a route for the presence of the
communities specified in the quickstart-communities community set. If any of the community values are
present in the route, the route policy sets the local preference attribute of the route to 31. In any case, the
policy instructs the protocol to accept the route.
community-set quickstart-communities
987:654,
987:543,
987:321,
987:210
end-set