Description
File: engine/userguide/networking/get-started-macvlan.md, CC @MistyHacks
I have been using the macvlan adapter with great success for awhile now on Ubuntu 16.04 with Kernel 4.4.0. Today however, I needed my host and my container able to communicate.
Underneath "Communication with the Docker host over macvlan", it says:
A macvlan subinterface can be added to the Docker host, to allow traffic between the Docker host and containers. The IP address needs to be set on this subinterface and removed from the parent address.
This sounds like exactly what I need, but the command ip link add mac0 link $PARENTDEV type macvlan mode bridge
is not enough for my system (Ubuntu 16.04). I still need commands for moving the IP address to the subinterface.
This blogpost and moby/libnetwork#2008 and this question had more commands than the official docs, but I was still unable to ping after running them:
sudo ip link add mac0 link $PARENTDEV type macvlan mode bridge
sudo ip addr add $PARENTIP/24 dev mac0
sudo ifconfig mac0 up
This blogpost looks the most complete with some route flushes, but it also failed to work for me.
What am I missing? ip route flush
and ip route add
maybe?
For now I am just going to edit /etc/network/interfaces
like the docs suggest and see how that goes.
Also, there is a minor typo at the end of that section. "For more on Docker networking commands, see Working with Docker network commands](/engine/userguide/networking/work-with-networks/)." -> "For more on Docker networking commands, see Working with Docker network commands."