[Dnsmasq-discuss] Leases file is not updated and dhcp-script is not called if Requested-IP is in the pool.

Vallevand, Mark K Mark.Vallevand at UNISYS.com
Fri Aug 27 14:45:54 UTC 2021


I do clear the leases database as described.

I have tried a newer version of dnsmasq and experimented with
script-on-renewal.  It really didn't seem to help with the problem.

Here is what I do and see (v 2.79)
- stop dnsmasq
- erase leases file
- write config file
- start dnsmasq
- client request with preferred ip in configured pool
- leases file *is not* updated
- dhcp-script *is not* called
- client request completes and begins to use the address
- client request to renew lease
- leases file *is* updated (yay)
- dhcp-script *is* called with 'add' (yay)

Subsequent client lease renews do not see the dhcp-script called.  Expected.
With a newer version, 2.86rc1, and script-on-renewal set, the subsequent
client lease renews *do* see the dhcp-script called with 'old'.  Again, this
is expected.  But, the behavior of dnsmasq does not otherwise change with
the newer version.

So, why is the lease file not getting updated?

When the initial client request has a preferred ip outside the pool or is
not included, it seems like things work as expected.


Mark K Vallevand
Unisys | 651-635-7708 | mark.vallevand at unisys.com 



THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is for use only by the intended recipient. If you received this
in error, please contact the sender and delete the e-mail and its
attachments from all devices.
   

Outside of a dog, a book is man's best friend.
Inside of a dog, it's too dark to read.
-  Groucho


-----Original Message-----
From: Dnsmasq-discuss <dnsmasq-discuss-bounces at lists.thekelleys.org.uk> On
Behalf Of Simon Kelley
Sent: Thursday, August 26, 2021 4:40 PM
To: dnsmasq-discuss at lists.thekelleys.org.uk
Subject: Re: [Dnsmasq-discuss] Leases file is not updated and dhcp-script is
not called if Requested-IP is in the pool.

EXTERNAL EMAIL - Be cautious of all links and attachments.

On 26/08/2021 20:21, Vallevand, Mark K wrote:
> I've erased the leases file and started dnsmasq.
>
> A client makes a request with a Requested-IP that is in the configured
pool.
>
> Dnsmasq replies and the client begins using the requested address.
>
> However, the leases file is not updated, and the dhcp-script is not
called.
>
> If the client requested address is outside the configured pool, the
> leases file is updated and the dhcp-script is called.
>
>
>
> What is the correct behavior if a requested address is not in the leases
> file?
>
> Shouldn't the dhcp-script be called?
>

Be careful about emptying the leases file. Dnsmasq keeps an in-memory
copy and only reads the file at start up, and writes it whenever it
changes. To clear the database, you need to do the following, in exactly
this order.

1) stop dnsmasq
2) delete leases file
3) start dnsmasq

The dhcp script is called whenever the data in the leases database
changes, _except_ that it's not called if the only change is to the
expiry time of an existing lease. Release 2.81 and later have an option
which enables a call to the script in this case.


Simon.

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss at lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7862 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210827/8f33b45d/attachment-0001.bin>


More information about the Dnsmasq-discuss mailing list