Disable IPv4 for container


I’ve just setup LXD on my Debian 10 KVM.
LXD is using the eth0 nic, there’s a radvd and DHCP server running on the same network.

When I launch a new container it’ll receive an IPv4 and IPv6 address.
However I’d like to run IPv6 only, is there some way to disable IPv4 DHCP for some specific containers?

And I haven’t figured out how to set a static IPv4/ IPv6 for a container.

Thank you!

is there some way to disable IPv4 DHCP for some specific containers?

I think you would need to create a seperate network (bridge etc.) for that specific container.

That might help:
ipv4.address - Use "none" to turn off IPv4 or "auto" to generate a new
ipv4.dhcp - Whether to allocate addresses using DHCP


Thank you, where do I have to add/ set those values?

root@ct:~# lxc network set eth0 ipv4.address none
Error: Only managed networks can be modified

What network are you using?

eth0, is not managed.

You need to use a bridge:
A bridge created by LXD is by default "managed"

You can create one and attach your container to it.

lxc network create

lxc network attach

I’m using the main NIC (eth0) of my VM since I’d like to have public IPs anyways.

I just reinstalled the VM and used the lxcbr0 this time.
IPv4 is set to none and for IPv6 I’ve used the IPv6 of my VM.
IPv6 NAT and external availability is set to true.

However the container can’t reach the internet

Sry, I guess, you need someone more professional than me :slightly_frowning_face:.

I only use macvlan most of the time.

Maybe you can find something when you search the forum.

I found this for example: