[Dnsmasq-discuss] Static leases issues

john doe johndoe65534 at mail.com
Mon Jun 8 17:36:20 BST 2020


On 6/8/2020 6:18 PM, Bruno BEAUFILS wrote:
> Hello everyone,
>
> I have got a static leases issue with dnsmasq 2.80-1 installed as
> Debian Buster package.
>
> I search the man page and the mailing list archives without any
> success. Thus I try here.
>
> Here is short summary of what I have.
>
> I am on a simple LAN with a screenless host running dnsmasq. It is the
> only, and thus main, DHCP server on the network.
>
> I use the dhcp-authoritative option in dnsmasq configuration.
>
> It offers a dhcp-range looking like that...
>
>      dhcp-range=192.168.0.200,192.168.0.250,12h
>
> ...and a bunch of static lease looking like something like that
>
>      dhcp-host=xx:xx:xx:xx:xx:xx,id:*,192.168.0.2,somename
>
> I want to use a new USB-ethernet adpator on a new laptop.
>
> On the first connection the host get a IP from the open range
> (192.168.0.203) as it is visible in the logs:
>
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) 12:34:56:78:9a:bc
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 12:34:56:78:9a:bc
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) 12:34:56:78:9a:bc
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 12:34:56:78:9a:bc
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPREQUEST(eth1) 192.168.0.203 12:34:56:78:9a:bc
>      Jun  7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPACK(eth1) 192.168.0.203 12:34:56:78:9a:bc mechra
>
> After the first connection I am able to log on the server and add a
> dhcp-host specific to that host. For that I did the following things
> in order :
>
> 1. stop the dnsmasq server
>
> 2. remove the leases file
>
> 3. modify the dnsmasq configuration in order to add the dhcp-host
>     option
>
>      dhcp-host=00:23:4d:df:a1:d1,id:*,192.168.0.15,somefancyname,24h
>
> 4. start the dnsmasq server
>
> After that I unplug the adaptor from the laptop and replug it in order
> for it to get the new IP from the static lease. Unfortunately I always
> get the same "old" adress (192.168.0.203), as the log shows (because
> the client asked it):
>
>      juin  7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPREQUEST(eth1) 192.168.0.203 12:34:56:78:9a:bc
>      juin  7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPACK(eth1) 192.168.0.203 12:34:56:78:9a:bc mechra
>
> I thought the dnsmasq should have refused the client request of using
> 192.168.0.203 (through a DHCPNAK for instance) and sent it a new
> OFFER with the correct static (192.168.0.15).
>
> Did I miss something (aka this is normal behavior but I misconfigured
> the whole stuff certainly because I did not understand the
> documentation well enough) or am I struggling with some kind of bug?
>
> Just in case it matters: all host used in the description are running Debian.
>

Try clearing the lease for the host in question:

$ systemctl stop dnsmasq
Remove the file altogether or remove the desired lease in the lease file:.
Lease file path: '/var/lib/misc/dnsmasq.leases'
$ systemctl start dnsmasq


IN plain English, you need to clear the lease or you need to wait for
the lease to expire.

HTH.

--
John Doe



More information about the Dnsmasq-discuss mailing list