I configured the dhcp network settings with the command,
lxc network create br0 ipv4.address=192.168.2.10/24 ipv6.address=none ipv4.nat=true ipv4.dhcp=true ipv4.dhcp.ranges=192.168.2.150-192.168.2.250 ipv4.dhcp.gateway=192.168.2.2 ipv4.dhcp.expiry=4h
And I found that in the /var/lib/lxd/networks/br0/dnsmasq.hosts directory there are ip addresses of each lxd hosts. Is there a way to assign static ip to every hosts in one dnsmasq.hosts configuration file?
Since the network is managed, you can get LXD to assign static IPs.
See Using static IPs with LXD for more.
I mean, mac/ip dnsmasq assignment. How lxd server assign ip addresses using dnsmasq? where can I find the dnsmasq mac address/ip address assignment?
Thanks for the link, I changed the container ip address and it works but I just want to know can we adjust the dnsmasq configuration file and get the same result as well.
If you Google about this, you will find posts that show how to edit dnsmasq manually.
Of course you can edit the settings manually, but you need to have a good understanding of how dnsmasq works. Specifically, you need to notify the running dnsmasq process that the file with the leases base been modified. I do not have that info handy, therefore have a look and report back so that you can help someone else as well.