Hello,
I’m using systemd-nspawn on a Manjaro host with NetworkManager disabled and instead systemd-networkd active:
● systemd-networkd.service - Network Management
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled;>
Active: active (running)
When following instructions from the Archlinux wiki:
- install a minimal image with pacstrap (base only) in /var/lib/machines
- change the root password
- log out
- start the container with machinectl
- login in the container as root
- start systemd-networkd
When systemd-networkd is launched, the container interface is misconfigured with the wrong IPv4 address.
Below is the interface on the host. Note that the interface has two IPv4 addresses.
$ ip a show ve-root
4: ve-root@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether da:f0:45:50:e7:3b brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet 169.254.192.63/16 metric 2048 brd 169.254.255.255 scope link ve-root
valid_lft forever preferred_lft forever
inet 192.168.232.177/28 brd 192.168.232.191 scope global ve-root
valid_lft forever preferred_lft forever
inet6 fe80::d8f0:45ff:fe50:e73b/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
On the container side, the interface is:
[root@root ~]# ip a show host0
2: host0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ee:47:cd:86:53:d5 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 169.254.193.148/16 metric 2048 brd 169.254.255.255 scope link host0
valid_lft forever preferred_lft forever
inet6 fe80::ec47:cdff:fe86:53d5/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
For some reason, the address is 169.254.193.148/16 while it should match the other one 192.168.232.177/28.
Indeed, if I manually add the other IP address and the route, the network is fine:
[root@root ~]# ip a add dev host0 192.168.232.176/28 metric 1024 brd 192.168.232.191 scope global
[root@root ~]# ip route add default via 192.168.232.177 dev host0 proto dhcp src 192.168.232.176 metric 1024
[root@root ~]# ip a show host0
2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ee:47:cd:86:53:d5 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 169.254.193.148/16 metric 2048 brd 169.254.255.255 scope link host0
valid_lft forever preferred_lft forever
inet 192.168.232.176/28 metric 1024 brd 192.168.232.191 scope global host0
valid_lft forever preferred_lft forever
inet6 fe80::ec47:cdff:fe86:53d5/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
[root@root ~]# ip route
default via 192.168.232.177 dev host0 proto dhcp src 192.168.232.176 metric 1024
169.254.0.0/16 dev host0 proto kernel scope link src 169.254.193.148 metric 2048
192.168.232.176/28 dev host0 proto kernel scope link src 192.168.232.176 metric 1024
root@root ~]# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=48 time=14.0 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=48 time=14.2 ms
I ignore why the container IP address is wrong. Any help would be appreciated ![]()
EDIT: behaviour is the same using Archlinux host with ufw firewall enabled