I have a cluster setup (with fan networks) and would like to reserve the first few ip addresses on each host for static containers (e.g. egress proxys).
dnsmasq.raw: dhcp-range can only be set once of the whole network across all hosts, which isn’t right for what I want in two different ways.
I can start the “service” containers after LXD start / restart, but this give rise to a brief period when these addresses could be allocated to another container.
Is there an “auto-start” option for containers which would allow these service containers to be started before all others?
I could probably fake it by adding something into /var/snap/lxd/common/lxd/networks/lxdfan0/dnsmasq.raw on each host, but this looks, to me, to be a fragile hack.
Can you advise, what’s the best option?
David
p.s. fanctl has a --host-reserve option for this purpose.
You can then use the IPs outside of those ranges safely knowing they won’t be allocated via DHCP.
And/or you can create static leases for your instances by assigning them an IP using lxc config device override <instance> eth0 ipv4.address=n.n.n.n and this will create a static DHCP reservation for that IP and MAC address.
thanks @tomp. How does that interact with the fan network?
I need a different DHCP range for each host with the fan network as each host “chooses” IP addresses from a different range of the whole subnet (depending on the host).
If I specify multiple ranges for the dnsmasq dhcp-ranges, will LXD pick the right subrange for each host?
A bit clunky but OK if it works.
I only tried 6 containers on each host, but they all were assigned addresses from the right range (which is vanishingly unlikely by random) so it works.