Docker Community Forums

Share and learn in the Docker community.

Macvlan network and host to container connectity

(Guardiande) #1


I’m wrestling with having a container on a macvlan network and still being able to talk to the host.

General setup
Host OS Ubuntu 16.04
Docker version 17.09.1-ce, build 19e2cf6
Host IP (standard Ubuntu br0 bridge)
Container IP

Docker network setup

docker network create -d macvlan --subnet --gateway -o parent=br0 -o macvlan_mode=bridge physical

Bridging another macvlan link to allow container host connectivity

ip link add mac0 link br0 type macvlan mode bridge
ip addr add dev mac0
ip link set mac0 up

Testing connectivity to LAN server (not host)

docker run --network physical -it --rm busybox ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.498 ms
64 bytes from seq=1 ttl=64 time=0.323 ms
64 bytes from seq=2 ttl=64 time=0.394 ms
--- ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.323/0.405/0.498 ms

Testing with host (not working)

docker run --network physical -it --rm busybox ping
PING ( 56 data bytes
--- ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

Any ideas?

(Bwstitt) #2

Did you ever figure this out? I am trying to run a docker registry with macvlan, but my host can’t pull from it :frowning: has the same steps as the official docs. I think maybe a kernel setting or something is in the way. I’m running Ubuntu with kernel 4.4.0

I found which has some addition ip commands that I think are what we are missing, but running ip route flush dev has ended poorly for me in the past, so I’d like some more guidance.