[systemd-devel] Changing configurations with networkd
Dan Williams
dcbw at redhat.com
Tue Nov 4 09:17:11 PST 2014
On Wed, 2014-07-23 at 16:46 +0200, Marcel Holtmann wrote:
> Hi Michael,
>
> >>> 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.
Digging up an old thread because I just ran into this situation.
A "so fast" DHCP client doesn't help if the server doesn't cooperate,
and we don't control the DHCP server.
The router I was using (which isn't a dirt-cheap one) doesn't care about
the client ID or hardware address, it will only give you the same IP
address back if you send your old IP address in the 'ciaddr' field and
your lease is still valid. And the 'ciaddr' field is zeroed on
DISCOVER, which means that to retrieve the same IP address/lease with
this router, REBOOT/RENEW is necessary. I suspect that's likely the
case for quite a few more routers out there as well. The router doesn't
have problems with other clients/OSs that I have found, just the systemd
DHCP code.
So it appears that to retrieve the same address again for as many
routers as possible, the lease details (lifetime, start time, last IP
address, client ID) should probably be stored somewhere for the client
to send later on reboot or service restart.
Dan
> 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.
>
> Regards
>
> Marcel
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list