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

Simon Kelley simon at thekelleys.org.uk
Thu Aug 26 21:39:59 UTC 2021



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.



More information about the Dnsmasq-discuss mailing list