RE: Behavior with "--lastlease" when DHCP server comes back
David Hauck
Wed Sep 14 17:31:15 2016
Hi Roy,
On Wed, 14 Sep 2016 at 10:03:00, Roy Marples wrote:
> Hi David
>
> On 14/09/2016 17:28, David Hauck wrote:
>> Hi Roy,
>>
>> I had a follow-up question below on this (old) thread:
>>
>> On Thu, 21 Apr 2016 at 08:45:00, Roy Marples wrote:
>>> Hi
>>>
>>> On 20/04/2016 20:08, Shahid Mahmood wrote:
>>>> Wanted to know the behavior if dhcpcd is started with --lastlease
>>>> option and it actually re-uses the last lease when dhcp server
>>>> disappears.
>>>>
>>>> 1) Does it try to renew the lease in case the server comes back or
>>>> does it keep that previous lease forever? If it does retry, how
>>>> often?
>>>
>>> It keep the lease forever. However, it should also DISCOVER a DHCP
>>> server in accordance with the backoff (so once every 60 +/- 1
>>> seconds). Any response is then treated for a normal renew.
>>>
>>> I've not tested this option for a long time, but it should still
>>> work.
>>>
>>>> 2) Same question, with additional --persistent option.
>>>
>>> lastlease actually requires the persistent option. Without it,
>>> dhcpcd would destroy the lease at exit.
>>
>> Are you saying that a non-expired lease will not be reused in the
>> case where 'lastlease' is used without the 'persistent' option? The
>> current man page suggests that the last lease will still be used in
>> the case where the lease hasn't expired and 'persistent' has not
>> been specified. I'm asking because I'm not sure what you mean by
>> "lastlease actually requires the persistent option"?
>
> If the persistent option is not specified then dhcpcd will drop the least at exit/carrier down.
> As such, there is no lease for the lastlease option to re-use.
>
> More clear?
Yes, that's pretty clear :).
However, perhaps the man page isn't? It says:
" -E, --lastlease
If dhcpcd cannot obtain a lease, then try to use the last lease acquired for the interface. If the -p, --persistent option is not given then the lease is used if it hasn't expired."
In what case will the last lease be used when 'persistent' hasn't been specified?
In addition, on startup (e.g., after a reboot) I thought the last lease was used (when 'lastlease' is specified) in order for 'dhcpcd' to populate option 50 (previous IP address). Otherwise how does 'dhcpcd' request the previously leased IP address during a reboot/restart?
Thanks,
-David
> Roy
Archive administrator: postmaster@marples.name