[Dnsmasq-discuss] Define default dhcp-range when multiple one exist

Jesus M Diaz jesusm.diazperez at gmail.com
Sat May 15 11:22:45 UTC 2021


I am trying to set different ranges in my dnsmasq configuration, to be used
based on tags. I have a series of dhcp-host entries, matching by
mac-address, and setting host-name and tag in most cases, and static lease
in others:

> ...
> dhcp-host=set:mobile,a2:b2:c2:d2:e2:f2,hostname2
> ...
> dhcp-host=set:entertainment,a3:b3:c3:d3:e3:f3,hostname3
> ...
> dhcp-host=a4:b4:c4:d4:e4:f4,ip-add4,hostname4,lease-time

I have 4 ranges, one for each 'tag', and one more for the unknown devices.

> dhcp-range=tag:mobile,,,30m
> dhcp-range=tag:entertainment,,,24h
> dhcp-range=tag:iot,,,72h

First, I tried to set tried to set the 'unknown' range as:


But this didn't work for the static-lease hosts, because as they are known
but don't match any of the other tags, there was no range available for

Then I tried to set it without any tag:


But then the tagged devices (*iot*, *mobile* and *entertainment*) used it
despite having a specific range defined for their tag.

So the only way I found to get this work was denying tags:


And this works fine, but it doesn't look as an elegant solution to me, and
makes me to add a new denied tag every time I add/change a range.

So, I wonder if there is any way to set a last resort range only to be used
if there is not any other match.

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210515/67f1fa42/attachment.htm>

More information about the Dnsmasq-discuss mailing list