I have a container that is no longer accessible via its .lxd domain name.
I investigated and found out that the LXD dhcp server lists this container with two different hwaddr.
Using ip -4 link in a container shell, I find that its hwaddr is 00:16:3e:67:78:71
lxc network list-leases lxdbr0 -f compact | grep 00:16:3e:67:78:71
shows:
* 00:16:3e:67:78:71 10.131.182.42 DYNAMIC
d9-67 00:16:3e:67:78:71 fd42:7a0b:c86c:b8b8:216:3eff:fe67:7871 DYNAMIC
Note the ‘*’ in the HOSTNAME column. Other containers show the expected hostname in both the ipv4 and ipv6 rows. The name d9-67 does not appear anwhere else in the list-leases output.
/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.hosts/d9-67.eth0 has a different hwaddr:
00:16:3e:a4:a5:fc,d9-67
This happened when I deleted and recreated the container, with the same name.
In order to keep the same ip address it had before, I configured the new container to have the hwaddr of the old container. I have been doing this regularly with most of my containers, and it usually works (the new container gets the ip addresses of the old container).
How can I fix this, and why did it happen? Is it wrong to reuse an old hwaddr the way I did?