[systemd-devel] accepting dhcp address only from a specific mask
Andrei Borzenkov
arvidjaar at gmail.com
Mon Jun 2 16:09:19 UTC 2025
02.06.2025 18:30, daggs wrote:
> Greetings Andrei,
>
> here:
> $ ip r
> 0.0.0.0 dev enp1s0 scope link
> default dev enp1s0 scope link
Those two lines are most certainly a problem. If they are installed by
systemd-networkd, I would call it a bug. Even with IPv4 local addresses
they are still wrong.
> default via 192.168.0.1 dev enp1s0 src 192.168.0.10 metric 1024
> 169.254.0.0/16 dev enp1s0 scope link src 169.254.39.180
> 192.168.0.0/24 dev enp1s0 scope link src 192.168.0.10 metric 1024
> 192.168.0.1 dev enp1s0 scope link src 192.168.0.10 metric 1024
>
>
>> Sent: Monday, June 02, 2025 at 6:16 PM
>> From: "Andrei Borzenkov" <arvidjaar at gmail.com>
>> To: systemd-devel at lists.freedesktop.org
>> Subject: Re: [systemd-devel] accepting dhcp address only from a specific mask
>>
>> 02.06.2025 16:07, daggs 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,
>>
>> Show
>>
>> ip r
>>
>> Multiple addresses on a interface is not something unusual.
>>
>>> 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 at 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
>>
>>
More information about the systemd-devel
mailing list