Link 将 systemd-nspawn 与 macvlan 一起使用时的容器和主机

Link container and host when using systemd-nspawn with macvlan

我正在像这样从 jessie 启动一个 debian jessie 容器:

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

容器通过 DHCP 从网关获取 IPv4,这很好,也可以到达外部服务器。但是我无法连接到主机,并且无法从主机访问容器的 IP。关于哪里出了问题以及缺少哪些步骤有什么想法吗?

(使用 debootstrap 创建的容器,只是添加了网络以通过 DHCP 设置 IP)

您需要在父计算机上创建一个 macvlan 以允许连接到您的 nspawn 来宾中的 macvlan。

查看此处的说明。 http://web.archive.org/web/20190917181922/http://noyaudolive.net/2012/05/09/lxc-and-macvlan-host-to-guest-connection/