Have dnsmasq resolve multiple domains form local hostnames
0
votes
1
answer
654
views
I am running dnsmasq 2.90 inside a Debian 11.0 based docker container as part of Pi-hole 5.18.2.
I would like to configure dnsmasq to serve the addresses of my local hostsnames for multiple local domains (both .local and .subdomain.mydomain.com) as a local application has the .local domain hard coded. I can only make it work for one domain at a time.
This container is providing DNS and DHCP services for my local networks. As part of the Pi-hole set-up
addn-hosts=/etc/pihole/local.list
is added to the .conf
file mounted at /etc/dnsmasq.d
. This list contains a list of ~30 IP addresses from local and locally accessible subnets and and hostnames, such as:
192.168.1.10 server01
192.168.2.20 server02
100.115.x.x server03
dnsmasq is serving the local search domain over DHCP both as specified in domain=subdomain.mydomain.com
and dhcp-option=option:domain-search.subdomain.mydomain.com
in separate config files mounted at /etc/dnsmasq.d
, as well as set as a local domain with local=/subdomain.mydomain.com/
.
This search domain, as well as the IP of the DNS server, is accepted and implemented as expected by my clients:
❯ cat /etc/resolv.conf
…
search subdomain.mydomain.com
nameserver 192.168.2.2
A nslookup
of a hostname in the addn-hosts
works as expected, adding the search suffix and returning the correct result:
❯ nslookup
> server01
Server: 192.168.2.2
Address: 192.168.2.2#53
Name: server01.subdomain.mydomain.com
Address: 192.168.1.10
I would like to return the same IP for server01.local:
> server01.local
Server: 192.168.2.2
Address: 192.168.2.2#53
** server can't find server01.local: NXDOMAIN
I have tried adding local to the .config files as local=/subdomain.mydomain.com/local/
both with and without domain=/subdomain.mydomain.com/local/
and separate domain=subdomain.mydomain.com
domain=local
entries. This either does not change the behaviour, or (if I add the two domain=
entries) the nslookup then works for .local
and not for .subdomain.mydomain.com
.
How can I have dnsmasq respond with the hostname IP for both .local
and .subdomain.mydomain.com
domains?
Asked by Spritsail Arrow
(1 rep)
Apr 24, 2024, 10:57 AM
Last activity: Apr 24, 2024, 11:51 PM
Last activity: Apr 24, 2024, 11:51 PM