0

I am running several services in docker containers for my homelab, and I need them to be accessible from their own distinct IPs. My host system is running debian "bullseye".

From the docker documentation, it seems natural to use a macvlan network in bridge mode, and the default way is working correctly for me.

However, I try to use a minimum of manual IPs in my network, and instead try to have my DHCP server assign almost all IPs, even for other servers. Of course, I then configure my DHCP to always assign the same IPs to my servers, based on the MAC-Adresses, but that way I can easily move a server from a testing network to my "live"-network, just by changing the IP assignment in the DHCP server.

I want to be able to do that with docker containers as well, i.e., assign docker containers an IP from DHCP in the hosts network.

Regarding this, I found no information in the docker documentation, and this open question on serverfault.

From my point of view, there are two possible routes to go:

  1. Create (manually) a subinterface on the host with dynamic IP, then use a host network in docker and bind it to the (manually) created subinterface?
  2. Somehow use a macvlan network. I do not know, how it needs to be configured to receive DHCP assignment, though.

I would like to either be suggested a better feasible solution, get some help on how to make progress on route 2. or get some affirmation that route 1. is the correct way to go.

marc
  • 101
  • 1

1 Answers1

0

Check out this project on GitHub.. Docker network driver for networking on a host bridge with DHCP-allocated IP addresses

https://github.com/devplayer0/docker-net-dhcp

pcmike
  • 1
  • Thank you for the suggestion. I tried ``docker-net-dhcp`` in the meantime, bout found it wasn't reliable enough. Due to some other problems with docker, I moved to podman since and I am using the DHCP CNI plugin. To mark this as an answer, I would like my points 1. and 2. still adressed for personal insight. – marc Jul 20 '22 at 13:32
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/525741) – bjoster Jul 21 '22 at 18:33