I would like to create a nspawn container connected to the network via macvlan and dhcp. All documentation I have found were very instructive but did not offer a step by step procedure for this setup.
What I did so far was to create the container (debian base) using debootstrap including systemd-container:
debootstrap --arch=armhf --include=systemd-container stretch /var/lib/machines/raspbian-09 http://archive.raspbian.org/raspbian Native host network
running:
systemd-nspawn -b -M raspbian-09 or creating
machinectl raspbian-09 with the unit file /etc/systemd/nspawn/raspbian-09.nspawn containing:
[Exec] Boot=true PrivateUsers=no [Network] Private=no VirtualEthernet=no and
machinectl raspbian-09 TheIn both cases, the network connection is fine.
Macvlan
For the macvlan, I either run the command:
systemd-nspawn -b -M raspbian-09 --network-macvlan=eth0 or
machinectl raspbian-09 with the unit file /etc/systemd/nspawn/raspbian-09.nspawn containing:
[Exec] Boot=true PrivateUsers=no [Network] MACVLAN=eth0 and
machinectl raspbian-09 TheIn both cases, the connection to the network does not work.
Within the container, I can see that an interface mv-eth0 is created:
# ip anetworkctl mv-eth0:IDX <BROADCAST,MULTICAST,UP,LOWER_UP>LINK mtu 1500 qdisc noqueue state UP group default qlen 1000 TYPE link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet6 xxxx::xxxx:xxxx:xxxx:xxxx/64 scope link OPERATIONAL SETUP valid_lft forever preferred_lft1 forever and
#lo networkctl IDX LINK TYPEloopback carrier OPERATIONAL SETUPunmanaged 2 mv-eth0 1 lo ether loopback degraded configuring however, there is no ipv4 address:
# ip carriera mv-eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc unmanagednoqueue state UP 2group mv-eth0default qlen 1000 link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff etherlink-netnsid 0 inet6 xxxx::xxxx:xxxx:xxxx:xxxx/64 scope link degraded valid_lft forever preferred_lft configuringforever but the interface does not get ipv4 address.
What other configurations on the host and container should be made?