Docker – Set MacVLAN in Portainer to Get IP from DHCP Server

dockerdocker-networking

I have a Portainer VM with 3 interfaces attached (eth0-eth2).
I would like the containers to request IP from the DHCP Server that is located on each interface at x.x.x.1.

Lets take as an example eth0:

The subnet of this interface is 172.16.0/27 and I would like my containers get in IP in the range of 172.16.0.17-30.
Under Portainer networks, I added another network with the following settings:

  • Name: 172Config
  • Driver: macvlan Parent card: eth0 Subnet: 172.16.0/27
  • Gateway: 172.16.1
  • IP Range: 172.16.16/28 ( I would like half of the subnet hosts to be provided to containers

Then I added another network:

  • Name: 172Network
  • Driver: macvlan
  • Macvlan configuration: Selected creation and then 172Config
  • Enable manual container attachment : True

Then I attached 172Network to a new httpd container but it doesnt work. I get the correct IP on the containers but I cant ping or establish any kind of connection to them. Any Portainer guru can advice whats the right way to do this?

Best Answer

The above configuration was correct. I had to set Promiscuous mode and Forged transmits to 'Accept' under the ESXi vSwitch security options. Once I've done that everything started working as expected and my firewall was able to list the new DHCP Leases.

Related Topic