Sample Header Ad - 728x90

systemd-nspawn/machinectl and macvlan

3 votes
1 answer
3106 views
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 machinectl raspbian-09 with the unit file /etc/systemd/nspawn/raspbian-09.nspawn containing: [Exec] Boot=true PrivateUsers=no [Network] Private=no VirtualEthernet=no In 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 In both cases, the connection to the network does not work. Within the container, I can see that an interface mv-eth0 is created: # networkctl IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback carrier unmanaged 2 mv-eth0 ether degraded configuring however, there is no ipv4 address: # ip a mv-eth0: mtu 1500 qdisc noqueue state UP group default qlen 1000 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 valid_lft forever preferred_lft forever What other configurations on the host and container should be made?
Asked by vivi (131 rep)
May 5, 2019, 10:01 AM
Last activity: Jan 27, 2025, 04:08 AM