Using stub-zones to create a "union" local subdomain?

I have a network with several routed segments; the routers offer WiFi connections and assign DHCP addresses. IP connectivity works fine.

Clients of a single router can reach each other by DNS name because the DHCP server (dnsmasq) maintains a local database of assigned names. However, clients of router-1 can't resolve names of clients attached to router-2 (unless they specifically ask router-2 for the name -- but clients generally don't know which router another client is connected to at the moment).

All the routers point to an unbound server running at one router for their non-local resolution services.

Is there a way to configure unbound to query multiple stub-zone servers (the routers) for names in a particular domain? I can provide multiple IPs in a stub-zone configuration block, but if unbound receives an NXDOMAIN from one router, it won't proceed to ask the other routers.

What I think would work is a way to disregard NXDOMAIN from stub-zone servers. That way, if a client of r-1 asks for a client of r-2, unbound will query r1, r2, r3, ... and if any of them respond with an A record, the client can reach its peer.

The alternative of setting up a local dynamic DNS server seems like a lot of work for this use case.

Thanks,

Hello,

Forgive me if this over simplifies your issue, but why wouldn’t you have a single Authoritative server and point Unbound at that? Then everything would just use that Authoritative server for name resolution. I recommend setting up an NSD server for Authoritative and pointing Unbound at it. Then set the Unbound server(s) as your DNS server(s) on all of your devices. That way you have a singular place for your DNS entries / a single place to query.

Thank you,
Steven

Thanks, Steven!

why wouldn't you have a single Authoritative server and point Unbound
at that? Then everything would just use that Authoritative server for
name resolution. I recommend setting up an NSD server for
Authoritative and pointing Unbound at it. Then set the Unbound
server(s) as your DNS server(s) on all of your devices. That way you
have a singular place for your DNS entries / a single place to
query.

The problem is, I don't have a single place that knows all the names and addresses of the DHCP clients -- each router assigns IP addresses for its own WiFi and LAN segments.

I could have a subdomain for each router: "client.r1.example.com", "client.r2.example.com", but then I would have to know which router a client was connected to at any time, if I wanted to reach the client by name. And if the client moves to a different router, its FQDN changes.

My goal is to be able to say "ping client.example.com", and get the client's current IP address, no matter which router it's connected to.

Hi David,

I believe DNSmasq has a hook that can call arbitrary scripts after a DHCP lease has beengiven out. In the past I used this hook to communicatie to my DNS resolver: I used Dnsmasq only for DHCP, and Unbound for recursive DNS. You can write a simple shell script to tell you central DNS server about new clients: pushing new DNS information in stead of pulling it from multiple servers.

Kind regards,

  Tom