I'm fiddling with systemd-nspawn
containers on my RaspberryPi. So far booting works fine. I use the --network-veth and --network-bridge=br0 options and bridging did work well with a kvm virtual machine.
Now I want to configure the container IP to a specific address and created a /etc/systemd/network/host.network
file which seems to be ignored as the container gets its IP via DHCP.
This is the file.
[Match]
Name=host0
[Network]
DHCP=no
Address=192.168.0.16/24
Gateway=192.168.0.1
DNS=8.8.8.8
systemd-networkd is running:
root@bluehost-debian:~# systemctl status systemd-networkd.service
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled)
Active: active (running) since Do 2016-09-01 21:10:54 UTC; 12min ago
Docs: man:systemd-networkd.service(8)
Main PID: 69 (systemd-network)
Status: "Processing requests..."
CGroup: /machine.slice/machine-bluecloud.scope/system.slice/systemd-networkd.service
└─69 /lib/systemd/systemd-networkd
Sep 01 21:10:54 bluehost-debian systemd-networkd[69]: host0 : link configured
Sep 01 21:10:54 bluehost-debian systemd[1]: Started Network Service.
Sep 01 21:10:55 bluehost-debian systemd-networkd[69]: host0 : gained carrier
Sep 01 21:10:58 bluehost-debian systemd-networkd[69]: host0 : DHCPv4 address 192.168.0.143/24 via 192.168.0.1
Sep 01 21:10:58 bluehost-debian systemd-networkd[69]: host0 : link configured
udev tells me that my value for the Name field should be ok. Why is it ignored?
udevadm info /sys/class/net/host0
P: /devices/virtual/net/host0
E: DEVPATH=/devices/virtual/net/host0
E: IFINDEX=2
E: INTERFACE=host0
E: SUBSYSTEM=net
Otherwise the network works ok. Tried /etc/network/interfaces
but this did not work in startup but only with ifup... (allow-hotplug host0 ...)
I'm a little stuck so help is appreciated.
00-host.network
and that did the trick... read something about a bug with network in the container until 217... debian had 215 and in backports is 230.