Help need Local DNS

The issue I am facing:

I would like to use local DNS records so that when I type "NAS" into my browser, it automatically refers to local IP address 192.168.88.199

Details about my system:

PiHole & Unbound as a docker (in my router)

What I have changed since installing Pi-hole:

Tried to:

add local DNS records into the "dns.hosts" setting -> didnt work

used also the " dns.expandHosts" -> didnt work

Please help me I have trying to find a solution for several hrs...

Hi I have Pihole & unbound running in a docker on my router.

I would like to use some local DNS records so when i type in NAS into by browser is refers to the correct lan IP address. (If I understood correctly I should use local DNS records for this.)

I have added both names and ip addresses in the pihole setting "dns.hosts" but somehow it is not working...

Can someone pls help me I have been on this for several hours..

I merged the two topics as they are basically the same.

With the browser, first make sure you can access the Pi-hole webGUI with below one:

http://pi.hole

And below one should produce an error bc flurry.com is on the default block list:

https://flurry.com

If not, your PC/client isnt using Pi-hole for DNS.
Or depending OS, DoT might be configured in the OS which bypasses Pi-hole.
Or the browser applies DoH to bypass Pi-hole.

Eg I have below DNS record:

$ sudo pihole-FTL --config dns.hosts
[ 10.0.0.3 nas.home.dehakkelaar.nl ]

When tested on the Pi-hole host (10.0.0.2 is my Pi-hole host):

$ dig +short @10.0.0.2 nas.home.dehakkelaar.nl
10.0.0.3

On a Windows client:

C:\>ipconfig

Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : home.dehakkelaar.nl
[..]
C:\>nslookup nas
Server:  ph6a.home.dehakkelaar.nl
Address:  10.0.0.2

Name:    nas.home.dehakkelaar.nl
Address:  10.0.0.3

Or:

C:\>ssh dehakkelaar@nas
dehakkelaar@nas's password:

EDIT: Or from a Linux client:

$ cat /etc/resolv.conf
search home.dehakkelaar.nl
nameserver 10.0.0.2
$ nc -vzw5 nas 445
nas.home.dehakkelaar.nl [10.0.0.3] 445 (microsoft-ds) open

Hi Thanks for merging the two topics...

pi.hole works as expected

nslookup pi.hole
Server: 192.168.34.2
Address: 192.168.34.2#53

Name: pi.hole
Address: 192.168.34.2
Name: pi.hole
Address: fe80::10e2:4bff:fea0:32b7

flurry.com works as expected

nslookup flurry.com
Server: 192.168.34.2
Address: 192.168.34.2#53

Name: flurry.com
Address: 0.0.0.0
Name: flurry.com
Address: ::

nas is not working as expected (as nas is mentioned in the local DNS record)

nslookup nas
Server: 192.168.34.2
Address: 192.168.34.2#53

** server can't find nas: NXDOMAIN

see screenshot below of DNS record

I have also added the output of the dig command. (192.168.88.1 & 192.168.34.2 are both ip addresses of my pihole)

dig @192.168.88.1192.168.88.1192.168.88.1192.168.88.1 nas

; <<>> DiG 9@192.168.88.1192.168.88.120.29 <<>> @192.168.88.1 nas
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 32202
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;nas. IN A

;; Query time: 0 msec
;; SERVER: 192.168.88.1#53(192.168.88.1) (UDP)
;; WHEN: Fri Sep 25 10:20:19 CEST 2026
;; MSG SIZE rcvd: 21

Hope this helps & thanks for you help

First figure out the DNS search/suffix domain name thats advertised by the DHCP service/router.
The one I showed on my two DHCP clients:

Or look it up in the DHCP/router settings.

And append that suffix name to the DNS record so it becomes a FQDN:

I suspect the dns.expandHosts setting in Pi-hole can also be used to expand into a FQDN but I haven't tinkered with that one yet.

Please post the output of this command (executed from Pi-hole machine):

sudo pihole api config/dns

Its running in Docker on the router so that would be a bit difficult :wink:

EDIT: @Bloemetjesgordijn, if you have access to the router shell (SSH or Telnet) as the root user:

docker exec -it <PIHOLE_CONTAINER_NAME> pihole api config/dns

You have to keep in mind that the first query going out the door when addressing a short hostname is one with the DNS search/suffix domain name appended!

Eg:

C:\>nslookup nas
Server:  ph6a.home.dehakkelaar.nl
Address:  10.0.0.2

Name:    nas.home.dehakkelaar.nl
Address:  10.0.0.3

Tailing the Pi-hole logs (can be done in the webGUI too):

$ sudo pihole tail
[..]
20:29:32: query[A] nas.home.dehakkelaar.nl from 10.0.0.179
20:29:32: /etc/pihole/hosts/custom.list nas.home.dehakkelaar.nl is 10.0.0.3
20:29:32: query[AAAA] nas.home.dehakkelaar.nl from 10.0.0.179
20:29:32: config nas.home.dehakkelaar.nl is NODATA-IPv6

I am not even sure if browsers allow that these days since they have removed stuff like SAMBA a.k.a. smb:// access for example ?!

Just typing in a short name is more mDNS behaviour IMHO and should be avoided.

Consider simply using nas.lan or nas.internal/nas.arpa or any of the other officially approved domains :slight_smile:

Since you are Dutch or Belgian according to your username : nas.thuis.lan is what I use :wink::+1::+1:

$ curl -kIL https://nas
HTTP/2 200

EDIT: Short names wont work properly with TLS though bc it requires a FQDN :wink:

LOL! Good to know! :grimacing: Thanks for testing! :oncoming_fist:

Sorry for my late reaction. I was out for a few days.

output of pihole api config/dns

pihole api config/dns
{
"config": {
"dns": {
"upstreams": \[
"127.0.0.1#5335"
\],
"CNAMEdeepInspect": true,
"blockESNI": true,
"EDNS0ECS": true,
"ignoreLocalhost": false,
"showDNSSEC": true,
"analyzeOnlyAandAAAA": false,
"piholePTR": "PI.HOLE",
"replyWhenBusy": "ALLOW",
"blockTTL": 2,
"hosts": \[
"192.168.88.13 caddy.lan",
"192.168.88.199 nas.lan"
\],
"domainNeeded": false,
"expandHosts": false,
"bogusPriv": true,
"dnssec": false,
"interface": "",
"hostRecord": "",
"listeningMode": "BIND",
"queryLogging": true,
"cnameRecords": [ ],
"port": 53,
"localise": true,
"revServers": [ ],
"domain": {
"name": "lan",
"local": true
},
"cache": {
"size": 10000,
"optimizer": 3600,
"upstreamBlockedTTL": 86400,
"rrtype": "ANY"
},
"blocking": {
"active": true,
"mode": "NULL",
"edns": "TEXT"
},
"specialDomains": {
"mozillaCanary": true,
"iCloudPrivateRelay": true,
"designatedResolver": true
},
"reply": {
"host": {
"force4": false,
"IPv4": "",
"force6": false,
"IPv6": ""
},
"blocking": {
"force4": false,
"IPv4": "",
"force6": false,
"IPv6": ""
}
},
"rateLimit": {
"count": 3000,
"interval": 60
}
}
},
"took": 0.00012636184692382812
}
/ #

Hope this helps

am Dutch :slight_smile:

I used nas.lan and caddy.lan but both aren't working.

Is "lan" the domain configured in the router settings and also reported on a DHCP client like below?

Did you check the Pi-hole logs like I explained below?

Hi deHakkelaar, thanks for your help and effort again ..

suffix domain made available in router

image

DNS referral made available in PiHole

Outcome / validation

A - nslookup

nslookup nas.home.local
Server: 192.168.34.2
Address: 192.168.34.2#53

** server can't find nas.home.local: NXDOMAIN

B - pihole tail

pihole tail

query[A] nas.home.local from 192.168.88.251
cached nas.home.local is NXDOMAIN

Thats odd!

I believe not the source of your problem but its recommended to NOT use .local as a top level domain as that one is reserved for mDNS exclusively.
Explanation and a list of alternative names in below mDNS RFC:

Appendix G.  Private DNS Namespaces

   The special treatment of names ending in ".local." has been
   implemented in Macintosh computers since the days of Mac OS 9, and
   continues today in Mac OS X and iOS.  There are also implementations
   for Microsoft Windows [B4W], Linux, and other platforms.

   Some network operators setting up private internal networks
   ("intranets") have used unregistered top-level domains, and some may
   have used the ".local" top-level domain.  Using ".local" as a private
   top-level domain conflicts with Multicast DNS and may cause problems
   for users.  Clients can be configured to send both Multicast and
   Unicast DNS queries in parallel for these names, and this does allow
   names to be looked up both ways, but this results in additional
   network traffic and additional delays in name resolution, as well as
   potentially creating user confusion when it is not clear whether any
   given result was received via link-local multicast from a peer on the
   same link, or from the configured unicast name server.  Because of
   this, we recommend against using ".local" as a private Unicast DNS
   top-level domain.  We do not recommend use of unregistered top-level
   domains at all, but should network operators decide to do this, the
   following top-level domains have been used on private internal
   networks without the problems caused by trying to reuse ".local." for
   this purpose:

      .intranet.
      .internal.
      .private.
      .corp.
      .home.
      .lan.

Once you've changed the domain name in the router, all your clients would have to renew their DHCP leases for the new domain name to be picked up.
Can do so by disconnecting them from network shortly or by power cycling routers, switches an Wifi AP's.
Or wait out the DHCP lease time which is usually about 12 or 24 hours depending router make/model.

Can you try resolving the nas name again + checking the logs after you've changed the domain name?
Just to be sure its not the .local causing issues.
And maybe try to resolve that nas name on another client too!

EDIT:

Oh and when querying for the FQDN instead of the short name like above, try put a dot at the end like so:

nslookup nas.home.local.

The trailing dot, without a name label, represents the root domain and results in nslookup not expanding the query with the DNS suffix domain.

And post output for below one again after the changes pls?

Could it be that there is something wrong with that setup and the settings you are applying are not written into the configuration correctly causing the Local DNS Records not to work ?!

That's pretty much the only thing I can think of in this case... :man_shrugging:

If you're using home.local as the domain then you do not need to include that in the dns.hosts or you can end up with

192.168.88.13 being caddy.home.local.home.local when it's being searched.

And you can not include domains that Pi-hole is not authoritative for.

Try entering only the caddy in dns.hosts value:

192.168.88.13 caddy
192.168.88.199 nas

Besides setting a dns.domain.name in Pi-hole, wouldnt you also be needing to enable dns.expandHosts when entering short names as DNS records bc the clients are querying DNS for a FQDN instead of a short one?
From the docs:

expandHosts

If set, the domain is added to simple names (without a period) in /etc/hosts in the same way as for DHCP-derived names

Also wouldnt you agree to change the .local name in the router to get that out of the way first?
Changing the domain name on the router involves reviewing all changes made on Pi-hole.

EDIT: Also I believe DNS only supports querying for a FQDN and not a short one without a dot somewhere???
From the wiki:

  Resource record (RR) fields
Field	Description	Length (octets)
NAME	Name of the node to which this record pertains	Variable
[..]
NAME is the fully qualified domain name of the node in the tree.

Oh it does support querying for short names but it doesnt return a record on my setup via a client (EDIT: note the dot in the QUESTION SECTION):

$ dig nas
[..]
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 33078
[..]
;; QUESTION SECTION:
;nas.                           IN      A
$ sudo pihole tail
[..]
Oct  7 09:15:41: query[A] nas from 10.0.0.234
Oct  7 09:15:41: config nas is NXDOMAIN

Vs:

$ dig nas.home.dehakkelaar.nl
[..]
;; QUESTION SECTION:
;nas.home.dehakkelaar.nl.            IN      A

;; ANSWER SECTION:
nas.home.dehakkelaar.nl.     2       IN      A       10.0.0.3
$ sudo pihole tail
[..]
Oct  7 09:17:09: query[A] nas.home.dehakkelaar.nl from 10.0.0.234
Oct  7 09:17:09: /etc/pihole/hosts/custom.list nas.home.dehakkelaar.nl is 10.0.0.3