LXD does sometimes assign a "wrong" IP to my macvlan Containers

Hello, first of all i have to say its great work what you are doing. I love LXD.
So i am playing around a bit, still exploring the greatness of Containers and their behaviour.
I made a macvlan Profile. The interesting part looks like this:

      nictype: macvlan
      parent: eth0
      type: nic

My Routers IP is
some times when i start a new container it does not assign a correct IP from my Router. Or it will, but not really.

e.g. i launch Container1 and it gets the IP if i look into “lxc list” (where the last digit matches the assigned IP from my Router, if i look into the connected devices on my Router there is shown Container1 with IP

But the problem is i can not ping the Container.

I can still access by “lxc shell Container1”, additionally the Container has Internet Access BUT it can not ping my router (lol).

If i start 10 Containers (no matter if i start one and wait a bit or start them in a bunch) its like 3 to 5 which get a “wrong” IP.
The other Containers get a correct IP (like for example) and can ping the router.

One could say, just launch another Container but i’d like to understand this circumstance.
Can anyone explain this ?

You should keep in mind that by default there is no access between container and host in a macvlan network.
See Section Troubleshooting in simos blog:

Nonetheless it is odd that the container gets a different IP.
Though looks very unusual to me.
But Wikipedia says it’s a valid private network, so I might be wrong.

Can you show your host’s network?
ip address

And also the network in the container?

And the full config of the container?
lxc config show containername -e

Yes i know, i was not able to ping them from my Laptop which is not the LXD Host.

I saw a Youtuber using this and thought it might be a nice idea to build a easy-to-remember ip network. I didnt even know there are valid ranges lol
Yes, i am pretty new to all of this…

Soo… Very unfortunately i can not reproduce this. I launched 20 Containers in a bunch but every one got a correct IP and no one is “broken”.
I did a Router Firmware Update today, (FritzOS 7.12 to 7.20 on a 7590).
I think it does have anything to do with that. The Firmware Update might have fixed it.

I do think now it does have absolutely nothing to do with LXD but my Router because i remember i once had problems with my Vacuum Robot connecting to my Network. (Was not able to open the Valetudo Webinterface, neither could ping it, after connecting to another Router and back to mine it worked, sometimes…)

Unfortunately i did not keep any broken Container from this morning… Is there any way to restore such a removed Container? Maybe we can find out more…

Best regards

LXD doesn’t really do anything funny here, the container just does DHCP on the macvlan device. So you getting the wrong address means that some DHCP server on your network returned that wrong address.

Given that the last 8 bits were correct, this would strongly suggest a router bug and hopefully that firmware update took care of it.

The only thing that was really unique to your container would have been its MAC address. If you can find it in a log somewhere, you could apply it again to a new container and see if the issue re-appears somehow.