[Dnsmasq-discuss] How to answer DNS for a host that has not gotten a lease?
Albert ARIBAUD
albert.aribaud at free.fr
Thu Dec 29 10:06:03 GMT 2016
Hi again John,
Le Thu, 29 Dec 2016 09:47:12 +0000
John Hanks <griznog at gmail.com> a écrit:
> My description was not good, maybe an example would be better.
> Hypothetical example:
>
> 1. New machine arrives, get MAC address from label on box.
> 2. Add "00:11:22:33:44;55,192.168.1.1,newhost,1d" to dnsmasq config.
> 3. restart dnsmasq
> 4. host newhost.my.domain results in "not found"
> 5. rack and power on newhost, DHCP lease established
> 6. host newhost returns 192.168.1.1
(I'll assume that you do not actually perform step 2 in the dnsmasq
config file but in the file specified by dhcp-hostsfile option, but
that's partly beside the point)
> The problem in my environment is that at step 4 I also want to
> configure a number of other tools that will complain about the host
> not being found and it may be days/weeks before the system actually
> gets booted up. So I'd like DNS queries to work independently of the
> lease being established. For dynamic hosts this isn't possible, but
> where I've tied a mac to a specific IP it is. I kludge this by
> converting these entries into a hostfile at every reload of dnsmasq
> with a wrapper script, but would like to eliminate that step if there
> is a way to have dnsmasq just return answers it knows or should know..
The behavior you describe is perfectly normal dnsmasq behavior. Step 2
defines a static *DHCP* lease, but not a *static* *DNS* entry-- see
options dhcp-hostsfile and dhcp-host in the man page.
What you want is provided by option host-record, and manage two files:
the static lease file (the one in step 2) to map the MAC and IP via DHCP
and possibly assign the DHCP client a hostname, and a hosts file to
map the IP and name statically in the DNS.
(and no, I don't know of a way to combine dhcp-host and host-record
into a single line, and I don't think there is except maybe through
scripting)
> Thank you,
NP/HTH
> jbh
Amicalement,
--
Albert.
More information about the Dnsmasq-discuss
mailing list