cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4321
Views
10
Helpful
9
Replies

Inter-VRF redistribution into BGP

paranengmoose
Level 1
Level 1

Hi I am trying to redistribute bgp-learned routes from VRF to global.

However, I got the below message.

"Inter-VRF redistribution is NOT allowed from 'bgp'".

 

Since I am currently running it in VIRL, I wonder if this is a legit error message.

In my understanding, it doesn't make sense that BGP doesn't allow Inter-VRF redistribution.

 

intervrf.jpg

 

Please advise.

9 Replies 9

Francesco Molino
VIP Alumni
VIP Alumni
Hi

You can't do that in this way.
Can you share your config and which subnets you want to leak between your vrf and global routing?

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

I am looking to do this exact same thing and am getting the same exact message. I need all BGP learned routes in vrf CUSTOMER to be redistributed into my global OSPF process. Can you provide solutions since I cannot find anything online so far.

 

Thanks,

Levi

Hi

There are different ways doing it.
Can you share your config to see which solution could fit better in your architecture?

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Here is a sample config:

 

ip vrf CUSTOMER
 description CUSTOMERS
 rd 200:0
 route-target export 200:0
 route-target import 200:0
 route-target import 0:0
!

ip vrf DEFAULT
 description DEFAULT_ROUTE
 rd 0:0
 route-target export 0:0
!

router bgp 12345
 bgp router-id 1.1.1.1
 !
 address-family ipv4 vrf CUSTOMER
  neighbor CUST-EBGP peer-group
  neighbor CUST-EBGP remote-as 64600
  neighbor CUST-EBGP soft-reconfiguration inbound
  neighbor 172.20.0.201 peer-group CUST-EBGP
  neighbor 172.20.0.201 description RTCUSTOMER1
  neighbor 172.20.0.201 activate
  neighbor 172.20.0.209 peer-group CUST-EBGP
  neighbor 172.20.0.209 description RTCUSTOMER2
 neighbor 172.20.0.209 activate
 neighbor 172.20.1.218 peer-group CUST-EBGP
 neighbor 172.20.1.218 description RTCUSTOMER3
 neighbor 172.20.1.218 activate
exit-address-family
!
!
router ospf 50
 router-id 1.1.1.1
 redistribute connected subnets
 redistribute static subnets
!

ip route vrf DEFAULT 0.0.0.0 0.0.0.0 Port-channel1 5.5.5.5 global

 

I would like all BGP routes learned from RTCUSTOMER1, RTCUSTOMER2 and RTCUSTOMER3 to be redistributed into OSPF process 50.

 

Thanks,

 

Levi

Here a config sample for your vrf CUSTOMER:

 

ip vrf CUSTOMER

  import ipv4 unicast map GLOBAL-TO-VRF

  export ipv4 unicast map VRF-TO-GLOBAL

!

ip prefix-list NET seq 10 permit 0.0.0.0/0 le 32

route-map GLOBAL-TO-VRF permit 10

 match ip address prefix-list NET

!

route-map VRF-TO-GLOBAL permit 10

 match ip address prefix-list NET

!

router bgp 12345

  address-family ipv4

!

router ospf 50

  redistribute bgp 12345 subnets

 

With this sample config, all subnets will be exchanged between your VRF and GRT. You'll need also to redistribute ospf 50 into your bgp AF ipv4 if you want your return traffic otherwise it won't work.

Test it on a vrf that's not critical or in a lab or create a fake vrf and see how it works.

 

Other methods exist using dynamic protocol and gre tunnel but i prefer this one which is straight forward.

 

 

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Thanks for the reply and sample. From what I see, you export all routes from the VRF's bgp table into the GLOBAL bgp table and then you redistribute all routes from GLOBAL bgp table into GLOBAL OSPF. I have two problems with this approach:

 

1 The VRF routes will be present in the GLOBAL bgp table and will get advertised to all BGP neighbors which I do not want. I want those routes to be known via OSPF only in the GLOBAL routing table.

2 ALL bgp routes get redistributed into OSPF which means not only the routes exported from the VRF but also the ones learned from other BGP peers. I don't want this either. I could attach a route-map to filter what gets redistributed into OSPF but I do not know exactly what prefixes those will be. This is a Data Center environment and different techs connect different customer routers over private lines assigning prefixes to customers dynamically so I can't predict what prefixes they will use and I can't give them access to modify the redistribution ACL on the fly.

 

So to reformulate the requirement, I need the BGP learner routes in vrf CUSTOMER and, only these routes, to be dynamically redistributed into the global OSPF process.

 

One other thing I was thinking of was to redistribute from BGP in the VRF to OSPF in the VRF but I am not aware of a technique to leak OSPF routes between VRF and Global.

 

Thanks,

 

Levi

Ok, you want only prefixes from your vrf CUSTOMER and your global ospf.

With the sample I provided, as I said it was an example and filtering using communities for importing into the GRT would work.

 

Anyways, now I understand better your requirement and there’s an easy way using GRE as I told previously.

 

Let me show you what the config will look like:

Create 2 loopbacks in the GRT:

 

interface Loopback50

 ip address 10.80.1.1 255.255.255.255

!

interface Loopback51

 ip address 10.80.2.1 255.255.255.255

!

 

Then create 2 tunnel interfaces:

 

interface Tunnel100

 ip address 169.255.50.1 255.255.255.252

 tunnel source Loopback50

 tunnel destination 10.80.2.1

!

interface Tunnel101

 ip vrf forwarding CUSTOMER

 ip address 169.255.50.2 255.255.255.252

 tunnel source Loopback51

 tunnel destination 10.80.1.1

 

Then create 2 ospf process (I used 2 process id for readability):

 

router ospf 99 vrf CUSTOMER

 router-id 10.80.2.1

 redistribute bgp 12345 subnets

 network 169.255.50.2 0.0.0.0 area 0

!

router ospf 98

 router-id 10.80.1.1

 network 169.255.50.1 0.0.0.0 area 0

 

And finally you need to redistribute back to your CUSTOMER address-family your vrf ospf process.

 

Does that make sense and fits your requirement?

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

This is exactly what I was looking for. It fits all my requirements. Thank you very much for your help!!!

You're welcome

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Review Cisco Networking products for a $25 gift card