Cisco Systems IOS XR Laptop User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Configuration Examples for Implementing Routing Policy
RC-243
Cisco IOS XR Routing Configuration Guide
endif
else
set community (2:999) additive
endif
end-policy
router bgp 2
neighbor 10.0.1.2 address-family ipv4 unicast route-policy inbound-tx in
Modular Inbound Policy: Example
The following policy example shows how to build two inbound policies, in-100 and in-101, for two
different peers. In building the specific policies for those peers, the policy reuses some common blocks
of policy that may be common to multiple peers. It builds a few basic building blocks, the policies
common-inbound, filter-bogons, and set-lpref-prepend.
The filter-bogons building block is a simple policy that filters all undesirable routes, such as those from
the RFC 1918 address space. The policy set-lpref-prepend is a utility policy that can set the local
preference and prepend the AS path according to parameterized values that are passed in. The
common-inbound policy uses these filter-bogons building blocks to build a common block of inbound
policy. The common-inbound policy is used as a building block in the construction of in-100 and in-101
along with the set-lpref-prepend building block.
This is a simple example that illustrates the modular capabilities of the policy language.
prefix-set bogon
10.0.0.0/8 ge 8 le 32,
0.0.0.0,
0.0.0.0/0 ge 27 le 32,
192.168.0.0/16 ge 16 le 32
end-set
!
route-policy in-100
apply common-inbound
if community matches-any ([100..120]:135) then
apply set-lpref-prepend (100,100,2)
set community (2:1234) additive
else
set local-preference 110
endif
if community matches-any ([100..666]:[100..999]) then
set med 444
set local-preference 200
set community (no-export) additive
endif
end-policy
!
route-policy in-101
apply common-inbound
if community matches-any ([101..200]:201) then
apply set-lpref-prepend(100,101,2)
set community (2:1234) additive
else
set local-preference 125
endif
end-policy
!
route-policy filter-bogons
if destination in bogon then
drop
else