MACVLAN duplicate entries in the router

I use MACVLAN to give my containers their own IP address. Unfortunately, each container gets an additional IP address from the router’s DHCP server in addition to the static IP address I set. The additional IP address contains a random MAC address that changes with every reboot, i. e. some useless entries accumulate in the router over time.
What is going wrong?

Greeting Ulf

are your containers running a dhcp client? Usually a docker container attached to a macvlan network will not get a dhcp lease unless you’ve gone out of your way to configure it to do so. When I run the macvlan driver, I specify a range on the docker network create command that is specifically outside the range that the dhcp server is configured to use as assignable addresses.

@skyhobbit007 is your docker host a Raspberry Pi?
I encountered a similar issue, could you please check if your scenario matches with what is described in this thread:

Yes …I also use a Raspberry Pi 4.

But I found a workaround: If you give the Raspberry itself a fixed IP-Address, everything works without problems.

Ok, thats good news :slight_smile:
I already tried that by setting a static ipv4 address via /etc/dhcpcd.conf and saw no difference.
How did you do it?

I have the same problem on my Raspberry Pi4.

Is there any news?

I am having the same issue others here and from the other post with the random mac address pulling leases from the router after every reboot. I have raspap installed as the “OS” and pihole in a docker container getting leases from a pfsense router. This was working fine for about 8 months and all of a sudden this issue has popped up. Below is a brief description of the process for what has been working for me until recently.

Installed raspap
installed docker
configured IPtables to accept docker user
created some volumes for pihole consistency
created docker macvlan network with IP addresses outside the DHCP range
added a macvlan shim with IP address outside the DHCP range
finally created the pihole container with IP address outside the DHCP range
static IP’d eth0 in the dhcpcd.conf file within the DHCP range

I did change the IP address for the eth0 interface to an IP address outside of the DHCP range and it did not help. All that did was assign new addresses to the macvlan-shim from the DHCP range. The only DHCP running on the raspberry (that I know of) is the DHCP for raspap for the wireless and that is on a completely different network.

I was able to find a work around by assigning a permanent mac address to the macvlan-shim interface on the raspberry pi. Then assigning a static ip to that mac address in the router. The only problem is that mac address is taking up two leases assigned to that mac address. So, giving me two IP addresses for the mac address. I rebooted the pi at least a dozen times and kept the same IP addresses. No problems for now…

I have not been able to find anything anywhere about stopping the random mac address assignment. I am very new to docker and I am still learning the fun with raspberry pi so maybe I missed something.