On 17/05/2021 10:22, Jesus M Diaz wrote:
> A couple of new things:
> 
> 1. I have updated the versionĀ of dnsmasq from 2.72 to 2.82, cloned from
> *https://salsa.debian.org/debian/dnsmasq
> <https://salsa.debian.org/debian/dnsmasq>* and compiled locally.
> 
> 2. Now I see a more explicit message in the log, making very clear the
> wrong behaviour:
> 
> tail -f /opt/var/log/dhcp | grep d0:4d:e3
> May 17 09:11:38 cinemateka dnsmasq-dhcp[1726]: 1039677414
> DHCPREQUEST(eth0) 192.168.0.217 96:8d:d4:d0:4d:e3
> *May 17 09:11:38 cinemateka dnsmasq-dhcp[1726]: 1039677414 DHCPNAK(eth0)
> 192.168.0.217 96:8d:d4:d0:4d:e3 address in use
> May 17 09:11:38 cinemateka dnsmasq-dhcp[1726]: not using configured
> address 192.168.0.217 because it is leased to a4:50:46:d0:4d:e3*
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 3254867558
> DHCPDISCOVER(eth0) 96:8d:d4:d0:4d:e3
> *May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 3254867558
> DHCPOFFER(eth0) 192.168.0.234 96:8d:d4:d0:4d:e3
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: not using configured
> address 192.168.0.217 because it is leased to a4:50:46:d0:4d:e3*
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 402483634
> DHCPDISCOVER(eth0) 96:8d:d4:d0:4d:e3
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 402483634 DHCPOFFER(eth0)
> 192.168.0.234 96:8d:d4:d0:4d:e3
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 402483634
> DHCPREQUEST(eth0) 192.168.0.234 96:8d:d4:d0:4d:e3
> May 17 09:11:41 cinemateka dnsmasq-dhcp[1726]: 402483634 DHCPACK(eth0)
> 192.168.0.234 96:8d:d4:d0:4d:e3 xiaomi-a2
> 
> So, dnsmasq clearly identifies the client and it knows there is a static
> lease configured, but it ignores it.
> 
> I also found other thread in the mailing list (not sure if this was the
> one you talked of, Geert), */[Dnsmasq-discuss] "multiple MAC addresses
> in a single dhcp-host" vs "multiple dhcp-host lines with the same IP
> address"/*, where in the answers Simon Kelly says:
> 
> Yes. The difference is that in the normal case of multiple lines, once
> the IP address is leased to a MAC address, if another MAC address turns
> up asking for a lease, it won't be offered that IP address (typically it
> will be offered one from the pool) *With multiple MAC addresses on a single 
> line, when the second MAC
> address turns up, the IP address will be unceremoniously ripped away
> from the first MAC address, and given to the second one.*

To answer the question, the host doesn't get the same address because
"multiple MAC addresses on the same line" is NOT the same as a MAC
address with wildcards in it. If you had

dhcp-host=96:8d:d4:d0:4d:e3,a4:50:46:d0:4d:e3,192.168.0.217

then it would work, but

dhcp-host=*:*:*:d0:4d:e3,192.168.0.217

doesn't.

I can't see why the code shouldn't  be altered to make this work, this
is just a case that nobody anticipated.


A possibly more tidy solution to this problem is to configure your
clients to send client-IDs in their DHCP requests. If client-IDs are
present, they totally override MAC addresses, so a client which always
send the same clienr-ID will always be identified and keep the same IP
address, even if its MAC address changes. Of course this only works if
you're OS/DHCP client combination allows configuration of client-IDs.
AFAIK all the common Linux ones do.



Cheers,


Simon.



_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to