Static IPs in FAN network for LXD 4.x

Hello.

We are using static IPs in the FAN network. But when we had migrated LXD from version 3.x to 4.x, we faced with an error. When we’re trying to set a static IP address for the FAN of the container network we see the error:

root@ubuntu1-test-fun-on-lxd4:~# lxc config device set test eth1 ipv4.address 10.10.1.10;
Error: Invalid devices: Device validation failed for "eth1": Cannot specify "ipv4.address" when DHCP is disabled on network "fanbr0" 

We checked dnsmasq – it’s working:

root@ubuntu1-test-fun-on-lxd4:~# ps aux | grep dns | grep fan
lxd      29574  0.0  0.0  43656  2604 ?        S    Jan26   0:02 dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/lxd/common/lxd/networks/fanbr0/dnsmasq.pid --except-interface=lo --no-ping --interface=fanbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=10.10.95.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/lxd/common/lxd/networks/fanbr0/dnsmasq.leases --dhcp-hostsfile=/var/snap/lxd/common/lxd/networks/fanbr0/dnsmasq.hosts --dhcp-range 10.10.95.2,10.10.95.254 -s lxd -S /lxd/ --conf-file=/var/snap/lxd/common/lxd/networks/fanbr0/dnsmasq.raw -u lxd

How we’ve found out, the error occurs because of this update of the code.

Is it possible to set static IPs for the fan network in version 4.x, or should we use another way?

Please can you show output of lxc network show fanbr0 thanks

Ah so the issue is because in fan networks the bridge’s ipv4.address is derived from the underlay subnet setting. And the bug is that the absence of ipv4.address indicates that DHCP isn’t enabled, even though it is. I’ll take a look at fixing this.

This PR fixes the issue:

Thanks. These are great news Will this PR be added to the stable fork (4.0x) or to the devel fork (4.1x)? And as we understand it will be happened within the next 1-2 weeks, that’s right?

Sorry for the intrusiveness, but we really need this fix ASAP :innocent:.

I would expect this would qualify for being backported to 4.0 LTS, @stgraber do you agree?

yep, I expect it to be included

We’ve tested new release on our servers, it’s works fine. Thank you.

1 Like