[Dnsmasq-discuss] DNS from dhcp-host while client is offline

Petr Menšík pemensik at redhat.com
Tue Oct 5 14:42:12 UTC 2021

Hi Michael,

On 10/5/21 14:43, Michael wrote:
> On 10/4/21 05:37, Dominik Derigs wrote:
>> Hey Petr,
>> On Mon, 2021-10-04 at 11:45 +0200, Petr Menšík wrote:
>>> Perhaps a flag could be added to dhcp-range, requesting also
>>> addition of dhcp-hosts to static dns.
>> Maybe this flag would better be set on --dhcp-host and --dhcp-
>> hostsfile if this is used? This would feel more "natural" to me.
>> Initially, I've myself found this an odd behavior to only serve
>> only DHCP host names that are known to be "alive". I do see some
>> value in not serving A records when we know the server is
>> offline, however, the very same happens on the Internet all the
>> time: no DNS server I'm aware of checks if an A record is
>> reachable before giving you the reply.
>> I've seen other systems using dnsmasq (it may or not have been
>> DD-WRT, no promises!) that created two files from static leases:
>> A dhcp-hostsfile and an addn-hosts file. Having an option to make
>> the latter obsolete sounds like a good idea.
> Maybe I am misunderstanding the issue, but dnsmasq already give the
> ability that is being asked for I believe.
> If you want a static DNS entry, add the entry to /etc/hosts or
> -addn-hosts=
> If you want a DHCP lease that always hands out the same ip address but
> is only valid during the lease, create a dhcp-host entry that includes
> the IP & hostname
> If you want a DHCP lease can always be looked up via DNS, add it to
> /etc/hosts or -addn-hosts and the dhcp-host entry contains the hostname
> Michael

Sure, we understand it is already possible. Our point is it may have
valid uses, but requires duplication of hostname and IP definition in
multiple files. It cannot be done just from single source file without
helper tool generating configuration data copy. It is not possible to
have static hosts IP definition AND mapping of MAC address in just
single place. It can be written in dhcp-host, /etc/ethers or /etc/hosts.
But it has to be always two places. It could be useful to have just
single line for each host and still able to fixed IP.

It requires additional tooling, when relatively simple change may allow
it directly without additional scripts. Just that.


Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB

More information about the Dnsmasq-discuss mailing list