[Dnsmasq-discuss] Disable dhcp-option for a single host
Petr Menšík
pemensik at redhat.com
Fri Jun 17 08:23:27 UTC 2022
On 05. 06. 22 13:41, Brian Rossa wrote:
> Hello,
>
> I'm doing some firmware-related work and am using a --dhcp-hostsdir
> setup to test several devices on my LAN. This is working fine, but I
> appear to have hit the limits of my dnsmasq-fu when attempting to
> *toggle* the DHCP options for a particular end host.
>
> Namely, (1) the global config sets enable-tftp and (2) the hostsdir
> config for the target device starts as "{mac},{ip},set:green". During
> my test I (3) update it asynchronously to "{mac},{ip},set:red" and (4)
> hit dnsmasq with SIGHUP. According to my understanding, this will
> cause dnsmasq to clear its host cache and reload the hostsdir configs.
>
> The only remaining question, then, is how to specify individual
> dhcp-option disablement for the target. Specifically, for "red" tags,
> I tried the following configuration to override the global tftp-enable
> setting:
>
> dhcp-option=tag:red,option:tftp-server,""
> dhcp-option=tag:red,option:tftp-server-address,""
> dhcp-option=tag:red,option:boot-file-size,""
> dhcp-option=tag:red,option:bootfile-name,""
What about doing just negated option? Send that option for every client
but few you don't want to. That is what you want, right? Send correct
values only to those, who are not in red tag.
dhcp-option=tag:!red,option:tftp-server,127.0.0.127
dhcp-option=tag:!red,option:tftp-server-address,127.0.0.127
dhcp-option=tag:!red,option:boot-file-size,123
dhcp-option=tag:!red,option:bootfile-name,"example.bin"
>
> Unfortunately, this approach seems to be flawed as the service
> complains that empty string is an invalid option and never comes up.
>
> Is there a common "disable" flag for scenarios like this? If so, I
> could not find it in the docs. If not, what approach is recommended
> for these kinds of per-host override situations?
>
> Thanks!
> ~br
>
Unless you have complicated conditions already, above solution should work.
--
Petr Menšík
Software Engineer, RHEL
Red Hat, http://www.redhat.com/
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB
More information about the Dnsmasq-discuss
mailing list