For some background…The host OS I’m using is Debian 12 and the container image is a Debian 12 container image. The host uses interface br0 which was created without utilizing the managed bridge functionality for .
Is there a “right way” of assigning a static IP to a container?
There are two ways that I know of. Either through your DHCP server or fixing it inside your container. Both are correct, it really just depends on how you’re organizing things.
That’s what I was thinking as far as setting it internally in the contain. My problem is the interface is changing at every restart. It’s going from eth0@if8 to eth0@if12 to eth0@if16…I would definitely like to do it programmatically because these containers are going to be moved often away from the dhcp server on this specific subnet so I need it to be reproducible.
Inside the container. The host of the containers isn’t managing the bridge at all so it’s just creating containers by default with a single network interface and a DHCP client enabled. The configuration I posted above is for inside the container and turns off the DHCP client of the container and enables the static IP address on the container.
just one more thing, before I saw this thread, I was originally going to post a question pertaining to my newly created containers not getting any IP address at all. would this also help with that or is my problem a separate issue?
If they’re not getting any IP address at all on an interface that is bridged, and there is a DHCP server running on the subnet they’re bridged to, then there may be another issue stopping the DHCP requests getting out or the responses getting back to the interface.
If you configure the interface to use a static IP on the subnet your DHCP server is serving, and other addresses in the subnet are accessible after doing so, then perhaps the container isn’t enabling the DHCP client.