Greetings Mantas,
 
here is what the command you've requested shows:
 
● 2: enp1s0
                  Link File: /usr/lib/systemd/network/99-default.link
               Network File: /etc/systemd/network/enp1s0.network
                      State: routable (configured)
               Online state: online                                          
                       Type: ether
                       Path: pci-0000:01:00.0
                     Driver: virtio_net
                     Vendor: Red Hat, Inc.
                      Model: Virtio 1.0 network device
           Hardware Address: xx:xx:xx:xx:xx:xx
                        MTU: 1500 (min: 68, max: 65535)
                      QDisc: fq_codel
IPv6 Address Generation Mode: eui64
   Number of Queues (Tx/Rx): 1/1
           Auto negotiation: no
                    Address:
169.254.39.180
                             192.168.0.10 (DHCPv4 via 192.168.0.1)
                             xxxx::xxxx:xx:xxxx:xxxx
                    Gateway:
192.168.0.1
                        DNS:
192.168.0.1
          Activation Policy: up
        Required For Online: yes
           DHCPv4 Client ID: IAID:0x56504d98/DUID
         DHCPv6 Client DUID: DUID-EN/Vendor:0000ab11ea37c4793baab851
 
 
Sent: Monday, June 02, 2025 at 4:16 PM
From: "Mantas Mikulėnas" <graw...@gmail.com>
To: "daggs" <da...@gmx.com>
Cc: systemd-devel@lists.freedesktop.org
Subject: Re: [systemd-devel] accepting dhcp address only from a specific mask
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