Background:
I am running a series of containers inside a Ubuntu VM (running Virtualbox, provisioned with Vagrant), all of which are attached to a macvlan Docker network and are assigned their own IP addresses. The Ubuntu VM is running on top of macOS. I have a bridged network adapter between the VM and my host (which is set to promiscuous mode and is the “parent” interface of the macvlan network), meaning I can access the containers by IP address from my Mac.
What I want to accomplish:
Being able to access containers inside the VM from the host machine is great, but I really would like to access them from any host on my network. Currently, if I try to ping my containers from a device on the network (other than my Mac running the VM), the pings are unsuccessful. However, I am able to ping the VM’s address from other devices in my network just fine.
I feel like I need to define a static route somewhere, but I’m not sure where or if that is even the right approach.
If anybody has any guidance, it would be appreciated! I know this is a somewhat strange configuration to have, but it’s somewhat necessary for what I’m ultimately using this for. Thanks!
Alright, I was able to get a step closer to solving my issue by using the ‘ipvlan’ driver. My best guess as to why this is is because macvlan is a layer 3 bridge while ipvlan is a layer 2 bridge. The following network create command made it so I was able to ping my containers from across the network.
However, this is not enough for me, since I also need unique MAC addresses for each one of my containers. Ipvlan does not assign unique MAC addresses (rather it will sit behind the parent interface’s MAC address). So it seems that I’ll probably have to use macvlan after all. Has anybody been able to address this issue?
If you don’t need unique MAC addresses like myself, then the following documentation should help: