[systemd-devel] Changing configurations with networkd

Marcel Holtmann marcel at holtmann.org
Thu Jul 24 05:05:24 PDT 2014


Hi Tom,

>>>>>> I think the lease should be remembered and reused in this case.
>>>>> 
>>>>> Hm, this sounds like a bug somewhere. When the new discover is sent
>>>>> out it should send the same identifying information to the server, and
>>>>> hence be given the same lease back again. Wireshark should tell you if
>>>>> the fault is networkd's or the DHCP server.
>>>> 
>>>> I get the same address at first, but after several minutes the DHCP server
>>>> decides to offer a new address. I should note, that I have a 10 minute
>>>> lease time for debugging purposes, so that might make the problem more
>>>> prominent. I'll see if I can figure out what happens here.
>>> 
>>> look at your DHCP server and see what lease time it really hands out after reboot.
>>> 
>>> However this is between you and your DHCP server. If you configure a lease
>>> time of 10 minutes, then that is the only guaranteed time for a given IP
>>> address. There is no mandate that the server has to give you the same address
>>> after 10 minutes when you ask again. It is valid to just get a different one.
>>> And that many home routers try to give you back the same one does not mean
>>> that they are required to do so.
>>> 
>>> The nice DHCP servers will remember your Ethernet address and/or identity
>>> information and give you back your old IP address. Either with the left over
>>> lease time or with a brand new lease time. There is really no need to store
>>> this information on disk. If the lease expired the information on disk are
>>> stale as well. And since our DHCP implementation is so fast, it makes really
>>> no difference.
>>> 
>>> It is safer start out with a brand new DHCP lease instead of having to deal
>>> with renewal during boot. At least that way you know the DHCP server is still
>>> there and you have a valid IP address. Just re-using a stored IP with a
>>> left-over lease is not safe anyway. You never know what changed in the
>>> network when you were off.
>> 
>> I think there was some misunderstanding here. I don't want to keep the
>> lease across reboots. I don't care about that. I think networkd should
>> remember the lease when restarting networkd only and not send a new dhcp
>> discover.
> 
> Right, I spoke too quickly. What I don't want is to preserve state
> between reboots, preserving it between restarts of networkd would
> indeed be fine. We already serialize the dhcp leases to /run, so I'd
> be happy to take a patch to deserialize these again when networkd
> starts.

I am not sure this is useful either. It feels like a bandaid for the time where networkd does not have an API to reload configuration changes. Killing networkd should give you a clean start from the configuration files and not magic cached value somewhere. Otherwise you end up with funny side effects all the time and have to explain to users to clear some /run states. Or ask them "to switch the computer off and back on again".

When you are opting for DHCP instead of static addresses, then there is really no guarantee for addresses staying the same. At least not for the client to know. So unless you own the DHCP server and configure it with static assignment. In all cases you have to confirm with the DHCP server that you address is still valid.

> That said, I'm not sure this will help you much in your case. It would
> allow us to explicitly request the current IP address when restarting
> networkd, but according to your previous email you already are getting
> assigned the correct IP address at first, and then only later does
> this change. What is causing your DHCP server to send out a different
> IP address later on, I don't know, but it seems unlikely that this is
> anything we can fix in the client.

I have my doubts as well here. Seems like a misconfigured DHCP server.

Regards

Marcel



More information about the systemd-devel mailing list