Send dhcp-users mailing list submissions to
        dhcp-users@lists.isc.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/dhcp-users
or, via email, send a message with subject or body 'help' to
        dhcp-users-requ...@lists.isc.org

You can reach the person managing the list at
        dhcp-users-ow...@lists.isc.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dhcp-users digest..."


Today's Topics:

   1. Re: dhcp-client and IPv4 lease times (Mike)
   2. Re: dhcp-client and IPv4 lease times (Mike)
   3. Re: dhcp-client and IPv4 lease times (Bob Harold)
   4. Re: dhcp-client and IPv4 lease times (Simon)


----------------------------------------------------------------------

Message: 1
Date: Fri, 10 Dec 2021 11:57:28 -0500
From: Mike <the.li...@mgm51.com>
To: dhcp-users@lists.isc.org
Subject: Re: dhcp-client and IPv4 lease times
Message-ID: <bc6b248d-e03c-0ca1-2960-1c8630ff4...@mgm51.com>
Content-Type: text/plain; charset="utf-8"

On 12/8/2021 4:33 PM, Simon wrote:

> Mike <the.li...@mgm51.com> wrote:
> 
>> From the environment passed to the script specified in dhclient4.conf, I
>> see, among others, the following variables:
>>
>> new_dhcp_lease_time=45605
>> new_dhcp_rebinding_time=34805
>> new_dhcp_renewal_time=2405
>>
>>
>> In the log for the dhclient daemon I see the following entry (sanitized):
>>
>> dhclient: ... -- renewal in 2121 seconds.
>>
>>
>> I have two questions:
>>
>> 1) Why is the renewal time specified in the log different than any of
>> the renewal times passed in the environment?
>>
>> 2) Why is not the renewal time taken to be half the lease time?
> 
> What lease time do you get ?

Thanks for the reply.

At the time, the lease length from the server was 86400 seconds.

A couple days ago, the lease length was 7200 seconds (the ISP was doing
some maintenance, and it is routine for the lease lengths to drop when
that occurs).

While the lease length from the server was 7200 seconds, I was seeing
lease renewal times in the order of 250 to 350 seconds.


> The lease you get is probably nothing like any of the values you?ve set at 
> the client end.

I've noticed. :)   I know that the time I set in the dhclient4.conf is
merely a hint to the server.


> You might need to do some packet capture on the interface to see what the 
> server is sending to you.

I started looking through the source code at the lease renewal time
processing.  I found some interesting things.


At one point, some randomness is introduced into the lease renewal time.
 I wrote a patch [see below] to remove that, and now the lease renewal
times shown in the environment variable and the lease renewal time shown
in the log record match up.

The lease renewal time is still short, i.e., it is still less than half
the lease length.  So I'm still wandering through the source code trying
to understand what is going on.


Thanks again for your reply.


Here's the patch... (also attached, because of word wrapping)


+++ ./client/dhclient.c Tue Dec  7 20:36:50 2021
@@ -1450,9 +1450,9 @@
                client -> new -> renewal = TIME_MAX;

        /* Now introduce some randomness to the renewal time: */
-       if (client->new->renewal <= ((TIME_MAX / 3) - 3))
-               client->new->renewal = (((client->new->renewal * 3) + 3) / 4) +
-                               (((random() % client->new->renewal) + 3) / 4);
+// mgm if (client->new->renewal <= ((TIME_MAX / 3) - 3))
+//             client->new->renewal = (((client->new->renewal * 3) + 3) / 4) +
+//                             (((random() % client->new->renewal) + 3) / 4);

        /* Same deal with the rebind time. */
        oc = lookup_option (&dhcp_universe, client -> new -> options,
@@ -1480,14 +1480,14 @@

        /* Make sure our randomness didn't run the renewal time past the
           rebind time. */
-       if (client -> new -> renewal > client -> new -> rebind) {
-               if (client -> new -> rebind <= TIME_MAX / 3)
-                       client -> new -> renewal =
-                                       client -> new -> rebind * 3 / 4;
-               else
-                       client -> new -> renewal =
-                                       client -> new -> rebind / 4 * 3;
-       }
+//mgm  if (client -> new -> renewal > client -> new -> rebind) {
+//             if (client -> new -> rebind <= TIME_MAX / 3)
+//                     client -> new -> renewal =
+//                                     client -> new -> rebind * 3 / 4;
+//             else
+//                     client -> new -> renewal =
+//                                     client -> new -> rebind / 4 * 3;
+//     }

        client -> new -> expiry += cur_time;
        /* Lease lengths can never be negative. */


-------------- next part --------------

+++ ./client/dhclient.c Tue Dec  7 20:36:50 2021
@@ -1450,9 +1450,9 @@
                client -> new -> renewal = TIME_MAX;
 
        /* Now introduce some randomness to the renewal time: */
-       if (client->new->renewal <= ((TIME_MAX / 3) - 3))
-               client->new->renewal = (((client->new->renewal * 3) + 3) / 4) +
-                               (((random() % client->new->renewal) + 3) / 4);
+// mgm if (client->new->renewal <= ((TIME_MAX / 3) - 3))
+//             client->new->renewal = (((client->new->renewal * 3) + 3) / 4) +
+//                             (((random() % client->new->renewal) + 3) / 4);
 
        /* Same deal with the rebind time. */
        oc = lookup_option (&dhcp_universe, client -> new -> options,
@@ -1480,14 +1480,14 @@
 
        /* Make sure our randomness didn't run the renewal time past the
           rebind time. */
-       if (client -> new -> renewal > client -> new -> rebind) {
-               if (client -> new -> rebind <= TIME_MAX / 3)
-                       client -> new -> renewal =
-                                       client -> new -> rebind * 3 / 4;
-               else
-                       client -> new -> renewal =
-                                       client -> new -> rebind / 4 * 3;
-       }
+//mgm  if (client -> new -> renewal > client -> new -> rebind) {
+//             if (client -> new -> rebind <= TIME_MAX / 3)
+//                     client -> new -> renewal =
+//                                     client -> new -> rebind * 3 / 4;
+//             else
+//                     client -> new -> renewal =
+//                                     client -> new -> rebind / 4 * 3;
+//     }
 
        client -> new -> expiry += cur_time;
        /* Lease lengths can never be negative. */

------------------------------

Message: 2
Date: Fri, 10 Dec 2021 11:59:17 -0500
From: Mike <the.li...@mgm51.com>
To: dhcp-users@lists.isc.org
Subject: Re: dhcp-client and IPv4 lease times
Message-ID: <2b202035-b134-3ad9-99c7-9b62b6c8d...@mgm51.com>
Content-Type: text/plain; charset=utf-8

On 12/8/2021 7:43 PM, Glenn Satchell wrote:
> 
> 
> On 2021-12-09 08:33, Simon wrote:
>> Mike <the.li...@mgm51.com> wrote:
>>
>>> From the environment passed to the script specified in dhclient4.conf, 
>>> I
>>> see, among others, the following variables:
>>>
>>> new_dhcp_lease_time=45605
>>> new_dhcp_rebinding_time=34805
>>> new_dhcp_renewal_time=2405
>>>
>>>
>>> In the log for the dhclient daemon I see the following entry 
>>> (sanitized):
>>>
>>> dhclient: ... -- renewal in 2121 seconds.
>>>
>>>
>>> I have two questions:
>>>
>>> 1) Why is the renewal time specified in the log different than any of
>>> the renewal times passed in the environment?
>>>
>>> 2) Why is not the renewal time taken to be half the lease time?
>>
>> What lease time do you get ?
>> The lease you get is probably nothing like any of the values you?ve
>> set at the client end. You might need to do some packet capture on the
>> interface to see what the server is sending to you.
>>
>> Simon
> 
> Those settings are more like hints to the dhcp server about the settings 
> you would like. The server configuration decides what values are used, 
> and you don't really have much control over that.

I understand that.  I've noticed that the lease length hint usually work
when it is shorter than what the ISP will provide, but it does not work
when it  is longer.

Thanks for the reply.




------------------------------

Message: 3
Date: Fri, 10 Dec 2021 13:23:14 -0500
From: Bob Harold <rharo...@umich.edu>
To: Users of ISC DHCP <dhcp-users@lists.isc.org>
Subject: Re: dhcp-client and IPv4 lease times
Message-ID:
        <ca+nkc8clbum55+w1vpbu+-gfztrafopeumw3svcpgh+fd8d...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Fri, Dec 10, 2021 at 12:06 PM Mike <the.li...@mgm51.com> wrote:

> On 12/8/2021 7:43 PM, Glenn Satchell wrote:
> >
> >
> > On 2021-12-09 08:33, Simon wrote:
> >> Mike <the.li...@mgm51.com> wrote:
> >>
> >>> From the environment passed to the script specified in dhclient4.conf,
> >>> I
> >>> see, among others, the following variables:
> >>>
> >>> new_dhcp_lease_time=45605
> >>> new_dhcp_rebinding_time=34805
> >>> new_dhcp_renewal_time=2405
> >>>
> >>>
> >>> In the log for the dhclient daemon I see the following entry
> >>> (sanitized):
> >>>
> >>> dhclient: ... -- renewal in 2121 seconds.
> >>>
> >>>
> >>> I have two questions:
> >>>
> >>> 1) Why is the renewal time specified in the log different than any of
> >>> the renewal times passed in the environment?
> >>>
> >>> 2) Why is not the renewal time taken to be half the lease time?
> >>
> >> What lease time do you get ?
> >> The lease you get is probably nothing like any of the values you?ve
> >> set at the client end. You might need to do some packet capture on the
> >> interface to see what the server is sending to you.
> >>
> >> Simon
> >
> > Those settings are more like hints to the dhcp server about the settings
> > you would like. The server configuration decides what values are used,
> > and you don't really have much control over that.
>
> I understand that.  I've noticed that the lease length hint usually work
> when it is shorter than what the ISP will provide, but it does not work
> when it  is longer.
>
> Thanks for the reply.
>


Are you setting all three?
min-lease-time
default-lease-time
max-lease time

I set all three the same.  I have seen others set them to different values,
and then the client can request a time somewhere between min and max, or
just take the default.

-- 
Bob Harold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.isc.org/pipermail/dhcp-users/attachments/20211210/89f2c2b5/attachment-0001.htm>

------------------------------

Message: 4
Date: Fri, 10 Dec 2021 18:27:43 +0000
From: Simon <dh...@thehobsons.co.uk>
To: Users of ISC DHCP <dhcp-users@lists.isc.org>
Subject: Re: dhcp-client and IPv4 lease times
Message-ID: <338ec534-bb3e-4bd6-bca8-0d3a48d48...@thehobsons.co.uk>
Content-Type: text/plain;       charset=utf-8

Bob Harold <rharo...@umich.edu> wrote:

> Are you setting all three?
> min-lease-time 
> default-lease-time
> max-lease time
> 
> I set all three the same.  I have seen others set them to different values, 
> and then the client can request a time somewhere between min and max, or just 
> take the default.

He?s got the client end, he won?t be able to see the ISP?s server config.

Simon



------------------------------

Subject: Digest Footer

_______________________________________________
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
dhcp-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/dhcp-users


------------------------------

End of dhcp-users Digest, Vol 158, Issue 3
******************************************

Reply via email to