[Dnsmasq-discuss] Delete a DHCP entry (cached)
simon at thekelleys.org.uk
Wed Jan 24 11:34:32 GMT 2007
Davide Ferrari wrote:
> El Miércoles, 24 de Enero de 2007 11:44, Davide Ferrari escribió:
>> I'm using dnsmasq 2.31, how could I delete an entry appearing in
>> dnsmasq.lease that I know it's not used anymore?
> Ok, it is as simple as delete the entry from dnsmasq.lease and send dnsmasq a
No, that won't work. It's likely that the entry will re-appear next time
dnsmasq writes the lease file. (The lease file only gets read when
dnsmasq starts up: after that it uses an in-memory copy of the data,
which gets written back to the file when it changes.
The correct procedure is
1) stop dnsmasq
2) edit lease file
3) start dnsmasq
> But I don't understand why dnsmasq didn't do it automatically...is there a
> dhcp timeout or something?
There is, it's called the lease time, and can be set per network
to set it to 5 hours
or per host
The first item on each line of the lease file is the time (in seconds
since midnight 1st January 1970) when the lease expires and will be
deleted. Zero means "never".
> I looked through the man page but with "timeout" I
> can only find the dhcp-authoritive option (which by the way now I've applied)
New releases of dnsmasq have a little utility in wrt/dhcp_release.c
which can be used to delete a lease early: it works by pretending to be
a client and using the DHCP RELEASE message. It was written to implement
removing DHCP leases in the GUI of DD-WRT, but it might be useful in
circumstances like this. (though it's probably easier to edit the lease
file or reduce the lease time so that the lease expires naturally).
More information about the Dnsmasq-discuss