On 28 Jun 2024, at 17:48, Buck Horn via Dnsmasq-discuss 
<dnsmasq-discuss@lists.thekelleys.org.uk> wrote:
> 
> In order to restore pre-2.86 behaviour, the documentation explicitly
> directs you to
> 
> > (...) use the configuration --address=/example.com/1.2.3.4
> --local=/example.com/
> 
> Note that address and local literals match, which they don't do in your
> configuration.
> 
> But I agree that NXDOMAIN being answered from config is somewhat
> surprising.
> From the docs, I'd expected that request to have been forwarded upstream.

Yeah, that is indeed not the case, which is why the man page confused
me. I.e. if I ask for some nonexistent name in the internal.example.com 
<http://internal.example.com/>
domain, I see:

  dnsmasq: query[A] quux.internal.example.com from 127.0.0.1
  dnsmasq: config quux.internal.example.com is NXDOMAIN

i.e. it does not forward anything but immediately answers authoritatively.

If I ask for an existing name, it returns an answer for the A record,
but similarly answers authoritatively without forwarding:

  dnsmasq: query[A] foo.internal.example.com from 127.0.0.1
  dnsmasq: config foo.internal.example.com is 10.1.2.3
  dnsmasq: query[AAAA] foo.internal.example.com from 127.0.0.1
  dnsmasq: config foo.internal.example.com is NXDOMAIN
  dnsmasq: query[MX] foo.internal.example.com from 127.0.0.1
  dnsmasq: config foo.internal.example.com is NXDOMAIN

I think we incorrectly interpreted the "To restore the pre-2.86
behaviour" section of the man page to mean that:

  local=/internal.example.com/
  server=1.1.1.1
  address=/foo.internal.example.com/10.1.2.3

would be sufficient to have those queries return NODATA. But instead, it seems 
you need:

  local=/internal.example.com/
  server=1.1.1.1
  address=/foo.internal.example.com/10.1.2.3 
<http://foo.internal.example.com/10.1.2.3>
  local=/foo.internal.example.com/ <http://foo.internal.example.com/>

and then duplicating the address & local lines for each fixed host.


> However:
> 
> On 28.06.24 15:38, Dimitry Andric wrote:
>> Sure, that also appears to work. I just don't know what the preferred
>> syntax is for declaring hosts that have fixed IP addresses, as opposed
>> to hosts that get addresses dynamically via DHCP.
> 
> If your use case is to provide names for hosts with static IP addresses,
> that should probably be tackled by using a hosts file, or by using
> host-records instead, e.g.:
> 
> domain=example.com
> domain-needed
> host-record=foo,foo.example.com,10.1.2.3
> host-record=bar,bar.example.com,10.1.2.4
> 
> 
> Above 'domain-needed' would prevent that non-dot queries (e.g. for foo)
> would be forwarded upstream.

In this case non-dot queries are not relevant for us, just the ones for
the subdomain name(s). We never want to forward anything for those.

-Dimitry


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to