Hello,
I have a system that has two network cards - one is connected to the outside world and one is connected to an internal VLAN that assigns IPs based on their MAC address.
I’d like to make containers appear as separate hardware on my second network. To do this it looks like i need to create a network using the maclan driver…
I’ve created a new docker network using the following command based on the docker documentation:
docker network create -d macvlan --subnet=192.168.70.0/24 -o parent=eth0 my-macvlan-net
i’ve then created a basic alpine container to test the connection:
docker run --name alpine --rm -dt --network my-macvlan-net --mac-address 02:42:ac:11:00:02 --ip 192.168.70.62 alpine
I’d like to ping this conatiner from the other systems connected on my existing second network VLAN (192.168.70.xx). Since the second network assigns IP using dnsmasq i’ve upated the config file with the mac address of the container that i specified when running the container and assigned it the same IP address (192.168.70.62).
When i bash into the container and run ifconfig i see that it has the correct MAC address and IP address i sepcifed but when i try pinging it from the host windows machine or any other device connected to the second network it doesn’t respond?
I also can’t seem to ping anything on my VLAN from the container? I’m a little confused by the command -o parent=eth0? I’m running docker on a windows machine - eth0 is usually used in linux machines to identify the network. I understand that docker uses a linux kernal underneith so this sort of makes sense if its mapping the network but was wondering if this is this trying to use my motherboard network card as the primary network? Is there a way to specify which network card in my windows PC to use or is the issue something else?
Many thanks!
Ollie