05-22-2025 07:39 AM
Hi everyone,
On IOS-XR 24.2, I’d like to configure MP-BGP in such a way that routes redistributed into MP-BGP (static, direct, OSPF) are exported with different route-targets.
I have tried using an export policy, but the issue there is that I can't specify the protocol.
I also tried doing it under MP-BGP during redistribution into the VRF, but it doesn't allow me to configure extended community route-targets.
Could you help me figure out what the solution is?
Solved! Go to Solution.
05-22-2025 09:51 AM - edited 05-22-2025 09:52 AM
Hi @Okejo ,
You can achieve your requirement with the following approach.
1. set a different community when you redistribute the connected, static and ospf routes in BGP under the vrf. For example 1:1 for connected, 1:2 for static and 1:3 for ospf routes.
2. in the export policy set the rt based on the community as follow:
route-policy export-policy
if community matches-any (1:1) then
set extcommunity rt (1:1)
endif
if community matches-any (1:2) then
set extcommunity rt (1:2)
endif
if community matches-any (1:3) then
set extcommunity rt (1:3)
endif
end-policy
05-22-2025 08:32 AM
Hello @Okejo
I also tried doing it under MP-BGP during redistribution into the VRF, but it doesn't allow me to configure extended community route-targets.
--Please share the config.
Thanks
05-22-2025 09:08 AM
I quickly made two examples
-first case:
vrf test-1
address-family ipv4 unicast
import route-target
10:100
!
route-policy export-test-1-static
if protocol is static then
set extcommunity rt 100:10
endif
set extcommunity rt 100:20
end-policy
router bgp 100
vrf test-1
rd 10:100
address-family ipv4 unicast
redistribute static
show configuration failed
vrf test-1
address-family ipv4 unicast
export route-policy export-test-1-static
!!% Could not find entry in list: Policy [export-test-1-static] uses the 'protocol' attribute. There is no 'protocol' attribute at the bgp export attach point.
-------second case:
vrf test-1
address-family ipv4 unicast
import route-target
10:100
!
route-policy test-1-static
set extcommunity rt 100:10
end-policy
router bgp 100
vrf test-1
rd 10:100
address-family ipv4 unicast
redistribute static route-policy test-1-static
show configuration failed
router bgp 100
vrf test-1
address-family ipv4 unicast
redistribute static route-policy test-1-static
!!% Could not find entry in list: Policy [test-1-static] uses 'assign rt'. 'set' is not a valid operator for the 'rt' attribute at the bgp redistribution-vrf attach point.
05-22-2025 09:23 AM - edited 05-22-2025 09:23 AM
please check the operations table, set ext comm is not supported under import vrf only inbound neighbor
05-22-2025 09:51 AM - edited 05-22-2025 09:52 AM
Hi @Okejo ,
You can achieve your requirement with the following approach.
1. set a different community when you redistribute the connected, static and ospf routes in BGP under the vrf. For example 1:1 for connected, 1:2 for static and 1:3 for ospf routes.
2. in the export policy set the rt based on the community as follow:
route-policy export-policy
if community matches-any (1:1) then
set extcommunity rt (1:1)
endif
if community matches-any (1:2) then
set extcommunity rt (1:2)
endif
if community matches-any (1:3) then
set extcommunity rt (1:3)
endif
end-policy
05-22-2025 01:27 PM
Thank you!
05-22-2025 02:05 PM
You are very welcome @Okejo and thanks for the feedback
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide