The second address looks like it comes from link-local, not from DHCP. I
suspect you have a higher-priority .network file that also enables DHCP
like yours does, but *also* sets "LinkLocalAddressing=both", like some of
systemd's built-in example .network files tend to do. Check `networkctl
status enp1s0` to verify which .network file is in use.

(Default is "LinkLocalAddressing=ipv6", don't set it to "no" as that
would break IPv6.)

On Mon, Jun 2, 2025 at 4:07 PM daggs <da...@gmx.com> wrote:

> Greetings,
>
> I have a qemu vm which runs a systemd based buildroot image, the vm's nic
> is virtio, if I configure systemd to auto start the nic, I get two ips for
> the only nic on the system, a valid one and in invalid one.
> in this case, I can only connect to local lan but not outside of the last,
> I once were able to get to a situation where only the valid ip is set and
> tested outside connection at it worked.
> here is the output of ip a:
>
> $ ip a
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 scope host lo
>        valid_lft forever preferred_lft forever
>     inet6 ::1/128 scope host noprefixroute
>        valid_lft forever preferred_lft forever
> 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP8000> mtu 1500 qdisc fq_codel
> qlen 1000
>     link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
>     inet 192.168.0.10/24 brd 192.168.0.255 scope global dynamic enp1s0
>        valid_lft 40422sec preferred_lft 40422sec
>     inet 169.254.39.180/16 brd 169.254.255.255 scope global enp1s0
>        valid_lft forever preferred_lft forever
>     inet6 xxxx::xxxx:xx:xxxx:xxxx/64 scope link
>        valid_lft forever preferred_lft forever
> 3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
>     link/sit 0.0.0.0 brd 0.0.0.0
>
> $ cat /etc/systemd/network/enp1s0.network
> [Match]
> Name=enp1s0
> [Network]
> DHCP=ipv4
>
> I'm no sure this is a systemd bug as I saw it when I tried a non systemd
> based env, so I'd like to try and prevent such allocation so the system
> will work until I can properly solve it.
> is it possible?
>
> Thanks
>
> Dagg
>

Reply via email to