Search code examples
containerssystemd

Link container and host when using systemd-nspawn with macvlan


I'm starting a debian jessie container from jessie like this:

systemd-nspawn --network-macvlan=eth0 -b -j -D /var/lib/container/debsid

The container get's an IPv4 from the gateway via DHCP, that's fine and also reaches servers outside. But I can't connect to the host and from the host the container's IP is not reachable. Any ideas on what is going wrong and which steps are missing?

(container created with debootstrap, just networkd is added to set the IP via DHCP)


Solution

  • You'll need to create a macvlan on the parent machine to allow for connectivity to the macvlans in your nspawn guests.

    Take a look at the instructions here. http://web.archive.org/web/20190917181922/http://noyaudolive.net/2012/05/09/lxc-and-macvlan-host-to-guest-connection/