Assign external ipv6 address and internal ipv4 to container

Hi,

I have a bare metal server in Hetzner with its standard network configuration (one IPv4 + subnet /64 IPv6). I would like to create a container via LXD that would have an external IPv6 address from that subnet and a local IPv4 address (e.g. received from lxdbr0). Additionally, I would like to forward several IPv4 ports to the container.

How to achieve this?
I read about routed NIC type. However, I have not found a description of the configuration in which the container gets external IPv6 and local IPv4.
The description suggests that since the addresses would have to be allocated from different pools, the configuration must point to two different “parent” devices. Which leads to the conclusion that the container should have two network interfaces (e.g. eth0 for ex-IPv6 and eth1 for local-IPv4). Am I right? Can this be simplified somehow?

Thank you for any advice, keyword or link to how-to.

Edit: I specified that this is a bare metal server.

Welcome!

Thanks for going through my tutorial. Admittedly, the tutorial needs desperately a refresh. I plan to refresh the whole set of network tutorials.
Here is the initial one, How to install and set up Incus on a cloud server – Mi blog lah! which talks about installing Incus (a continuation of LXD) on a Hetzner cloud server.

Having said that, Hetzner cloud servers can have up to one Primary IPv4 and IPv6 addresses. You cannot assign the Primary IP address to the container. If you really wanted to use a public IP address to an instance, you would use Floating IPs.

However, if you just want to perform port forwarding, then you do not need to assign public IP addresses to the containers. You can use the proxy device.

If you just want to host several websites in separate containers, you can use a reverse proxy in a container that will be able route any request to the appropriate website-in-a-container. There’s an old-ish tutorial for that as well that begs an update.

Having said that, Hetzner cloud servers can have up to one Primary IPv4 and IPv6 addresses. You cannot assign the Primary IP address to the container. If you really wanted to use a public IP address to an instance, you would use Floating IPs.

Thanks for the answer. As I wrote, I have one IPv4 and a pool of IPv6 addresses (subnet /64). I do not have Hetzner’s cloud server that these explanations refer to (Primary IP, Floating IPs). My question is not asked in the context of a Hetzner’s cloud server. I want to assign one of the IPv6 addresses to the container, of which there seem to be a lot.