I don't think I'm explaining the actual issue well enough, let me try to add as much detail as I can:
This isn't a general nameserver problem. It's only a a problem for aliases inside OPNsense, specifically a discrepancy between Dnsmasq and Unbound (with Unbound being the only unexpected one). The DNS setup works correctly on all hosts and the OPNsense, as far as I know and/or can tell, but ONLY the alias resolution is "weird".
First some answeres to your setup questions:
I don't have much experience with drill/dig (bit too verbose for me usually), but only the classic/old nslookup. Here are some results from various tools. ALL results are identical between running on a client system or run on OPNsense in an SSH session, unless where otherwise noted.
Now for the actual description of the problem case again:
When creating an alias of type "Host(s)" in the firewall that contains one or more <hostname>, they do not resolve correctly when using Unbound. When dnsmasq is used as the DNS server/resolver, they do work like that just fine. Again, the only change is the locally running DNS server/resolver. Again: no other host in the network is involved in any way in this either. And when using <hostname>.<localdomain>.<tld> in the alias, both DNS servers resolve them just fine, proving that the correct DNS is in use, or they wouldn't be resolvable either.
Unfortunately I can't trivially switch back and forth as the OPNsense is in production use, and I can't just randomly break (or at least interrupt) the network.
This isn't a general nameserver problem. It's only a a problem for aliases inside OPNsense, specifically a discrepancy between Dnsmasq and Unbound (with Unbound being the only unexpected one). The DNS setup works correctly on all hosts and the OPNsense, as far as I know and/or can tell, but ONLY the alias resolution is "weird".
First some answeres to your setup questions:
- OPNsense and all clients use the same DNS server, which is currently Unbound running on the OPNsense
- local domain is set for OPNsense via System-Settings-General-Domain
- local domain is set for all clients using DHCP (ISC; option "DNS Server" left empty; defaulting to globally set domain above)
- Upstream DNS servers are set in System-Settings-General-DNS servers, if I want to use them in the DNS
- The option "Do not use the local DNS service as a nameserver for this system" is disabled, so 127.0.0.1 SHOULD be used
- OPNsense seems to correctly use 127.0.0.1 for DNS requests
- Currently Unbound is in use as the DNS resolver, as I recently switched from Dnsmasq
- Unbound option "Register DHCP Static Mappings" is enabled and works correctly
- IPv6 isn't the problem, or even involved. The hostname(s) I'm talking about are in an IPv4 only part of the network.
- Edit: no aliases in unbound or dnsmasq are relevant or used, only hostname registration from DHCP and/or reservations
I don't have much experience with drill/dig (bit too verbose for me usually), but only the classic/old nslookup. Here are some results from various tools. ALL results are identical between running on a client system or run on OPNsense in an SSH session, unless where otherwise noted.
- ping <hostname> works
- ping <hostname>.<localdomain>.<tld> works
- nslookup <hostname> and nslookup <hostname>.<localdomain>.<tld> work and produce identical output:Code Select
Server: <opnsense-ip>
When run on OPNsense via SSH, <opnsense-ip> is instead 127.0.0.1 of course
Address: <opnsense-ip>#53
Name: <hostname>.<localdomain>.<tld>
Address: <actual-ip-of-hostname>
** server can't find <hostname>.<localdomain>.<tld>: NXDOMAIN - nslookup <actual-ip-of-hostname> returns <hostname>.<localdomain>.<tld> correctly
- dig -x <actual-ip-of-hostname> also returns <hostname>.<localdomain>.<tld> correctly
- drill -x <actual-ip-of-hostname> returns <hostname>.<localdomain>.<tld> correctly on clients, but not on OPNsense *
- drill -x <actual-ip-of-hostname> @<opnsense-ip> works correctly (everywhere)
- dig <hostname>.<localdomain>.<tld> returns correct results
- dig <hostname> does NOT return the result, but I assume this is normal?
- drill <hostname> does NOT return the result, but I assume this is normal?
- drill <hostname>.<localdomain>.<tld> works on clients, but not on OPNsense *
Now for the actual description of the problem case again:
When creating an alias of type "Host(s)" in the firewall that contains one or more <hostname>, they do not resolve correctly when using Unbound. When dnsmasq is used as the DNS server/resolver, they do work like that just fine. Again, the only change is the locally running DNS server/resolver. Again: no other host in the network is involved in any way in this either. And when using <hostname>.<localdomain>.<tld> in the alias, both DNS servers resolve them just fine, proving that the correct DNS is in use, or they wouldn't be resolvable either.
Unfortunately I can't trivially switch back and forth as the OPNsense is in production use, and I can't just randomly break (or at least interrupt) the network.