Docker container connection in macvlan network

dockerhyper-v

I have a CentOS 7 Hyper-V VM running on Windows Server 2012 R2 that acts as my Docker host. I'm trying to place my containers in a LAN with other VMs by using Docker's macvlan network driver.

Network:

docker create network -d macvlan --subnet=10.1.0.0/24 --gateway=10.1.0.1 -o parent=eth0 macnet

Container:

docker run --net=macnet -it --ip=10.1.0.2 ubuntu bash

From the container, I'm unable to ping the gateway. I did tcpdump -n -i eth0 on the Docker host and saw arp requests from the container but no replies. The Docker host VM's NIC is an external network virtual switch which I suspect is the cause. Is there some configuration that I'm missing?

Best Answer

You need enable promiscuous mode in Hyper-V.

Hyper-V > VM > Settings > NIC (click plus) > ADVANCED FEATURE > Enable MAC Address Spoofing