Unable to resolve hostname on computer running Pi-hole

I have Pi-hole running on Ubuntu Server 22.04. The IP address is 10.100.0.2 and the hostname is frigg. The /etc/resolv.conf shows the following.

nameserver 127.0.0.1
nameserver 10.100.0.2
search home.linuxtraveler.blog

I added the 10.100.0.2 and the search domain. The local host was added from the installation of the Ubuntu Server.

Expected Behaviour:

When I use any computer on my network, except frigg. I can resolve the hostnames listed in Pi-hole's local DNS. Here is the output from nslookup on my desktop running LMDE 6.

dale@Vali:~$ nslookup
> server
Default server: 10.100.0.2
Address: 10.100.0.2#53
> gateway
Server:		10.100.0.2
Address:	10.100.0.2#53

Name:	gateway.home.thelinuxtraveler.blog
Address: 10.100.0.1
>

Here is what is shown in the pihole.log.

Feb 5 18:29:55: query[A] frigg.home.thelinuxtraveler.blog from 10.100.0.194
Feb 5 18:29:55: Pi-hole hostname frigg.home.thelinuxtraveler.blog is 10.100.0.2 
Feb 5 18:30:03: query[A] gateway.home.thelinuxtraveler.blog from 10.100.0.194
Feb 5 18:30:03: /etc/pihole/custom.list gateway.home.thelinuxtraveler.blog is 10.100.0.1
Feb 5 18:30:03: query[AAAA] gateway.home.thelinuxtraveler.blog from 10.100.0.194
Feb 5 18:30:03: config gateway.home.thelinuxtraveler.blog is NODATA-IPv6

Actual Behaviour:

When I am logged into frigg. I can't resolve the hostnames listed in the Pi-hole's local DNS. Here is the output using nslookup with localhost. I get the error "** server can't find gateway: NXDOMAIN".

Here is what is shown in the pihole.log.

Feb 5 18:17:05: query[A] gateway.home.linuxtraveler.blog from 127.0.0.1
Feb 5 18:17:05: cached gateway.home.linuxtraveler.blog is NXDOMAIN
Feb 5 18:17:05: query[A] gateway from 127.0.0.1
Feb 5 18:17:05: config gateway is NXDOMAIN
Feb 5 18:17:16: query[A] frigg.home.thelinuxtraveler.blog from 10.100.0.194
Feb 5 18:17:16: Pi-hole hostname frigg.home.thelinuxtraveler.blog is 10.100.0.2

I get the same error when nslookup is using 10.100.0.2 (frigg's IP address).

When I use nslookup with 10.100.0.2 (frigg's IP address) here is what is shown in the pihole.log

Feb 5 18:22:54: query[A] gateway.home.linuxtraveler.blog from 10.100.0.2
Feb 5 18:22:54: cached gateway.home.linuxtraveler.blog is NXDOMAIN
Feb 5 18:22:54: query[A] gateway from 10.100.0.2
Feb 5 18:22:54: config gateway is NXDOMAIN

If I use the FQDN on frigg, it will resolve them to the IP address.

dale@frigg:~$ nslookup
> server
Default server: 127.0.0.1
Address: 127.0.0.1#53
Default server: 10.100.0.2
Address: 10.100.0.2#53
> gateway.home.thelinuxtraveler.blog
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	gateway.home.thelinuxtraveler.blog
Address: 10.100.0.1
>

Here is what is shown in the pihole.log.

Feb 5 18:46:56: query[A] gateway.home.thelinuxtraveler.blog from 127.0.0.1
Feb 5 18:46:56: /etc/pihole/custom.list gateway.home.thelinuxtraveler.blog is 10.100.0.1
Feb 5 18:46:56: query[AAAA] gateway.home.thelinuxtraveler.blog from 127.0.0.1
Feb 5 18:46:56: config gateway.home.thelinuxtraveler.blog is NODATA-IPv6

Here is what is shown when I use frigg's IP address with nslookup.

> server 10.100.0.2
Default server: 10.100.0.2
Address: 10.100.0.2#53
> gateway.home.thelinuxtraveler.blog
Server:		10.100.0.2
Address:	10.100.0.2#53

Name:	gateway.home.thelinuxtraveler.blog
Address: 10.100.0.1
>

Here is what is shown in the pihole.log.

Feb 5 18:49:44: query[A] gateway.home.thelinuxtraveler.blog from 10.100.0.2
Feb 5 18:49:44: /etc/pihole/custom.list gateway.home.thelinuxtraveler.blog is 10.100.0.1
Feb 5 18:49:44: query[AAAA] gateway.home.thelinuxtraveler.blog from 10.100.0.2
Feb 5 18:49:44: config gateway.home.thelinuxtraveler.blog is NODATA-IPv6
Feb 5 18:49:48: query[A] frigg.home.thelinuxtraveler.blog from 10.100.0.194
Feb 5 18:49:48: Pi-hole hostname frigg.home.thelinuxtraveler.blog is 10.100.0.2

Debug Token:

https://tricorder.pi-hole.net/s6FGN6Em/

A friend is using Debian 11 to run Pi-hole. He also has local DNS configured. When he is logged into his Debian 11 computer (that is running Pi-hole) he can resolve hostnames along with his other computers.
I don't know why I can't do the same on my Ubuntu Server running Pi-hole. I just updated Pi-hole to the current version with no change in behavior.

Thank you,
Dale

Your log excerpts do not match the lookup commands you've shared.

E.g. for a plain nslookup gateway, nslookup would be expected to generate 4 DNS requests in your case, i.e. one A and AAAA request for the plain gateway, and one A and AAAA for gateway.home.thelinuxtraveler.blog.

Note that gateway and gateway.home.thelinuxtraveler.blog are two distinct domain names.
Your debug log shows that you've created a custom DNS record only for the latter, so NXDOMAIN for gateway is expected.

So from what you've shared, it seems likely that you'd lack an A record definition for gateway.

Note that if instead of gateway.home.thelinuxtraveler.blog you'd created a custom record for gateway, Pi-hole would have automatically created the respective FQDN for you (by virtue of dnsmasq's domain and expand-hosts configuration options, as shown in your debug log).




I can nslookup gateway which resolves to gateway.home.thelinuxtraveler.blog on every computer on my local network. Except for frigg, nslookup can't lookup gateway.
Why? Every other computer can except for the one running Pi-hole, which is frigg.

I can resolve every hostname on frigg except for gateway.

No, it doesn't.

As explained, it is nslookup that creates the DNS requests.
It would usually generate an A and AAAA record for the domain as given, and another set those requests for that domain expanded by a search domain(s) known by the OS it runs on, depending on its configuration(!).
So in your case, I'd expect it to send 4 DNS requests in total (as explained).
Out of these four requests, it is only the requests for gateway.home.thelinuxtraveler.blog that gets answered with an IPv4 address with your Pi-hole's current definitions.

I cannot tell which requests your nslookup have made, however, since your log excerpts do not match your nslookups, e.g. they show only A requests, or only the request for the expanded domain, and sometimes they mix requests for a different domain like gateway and frigg.

Thus, I cannot comment on a specific nslookup behaviour.

What I can tell is that for the individual DNS requests from your logs, Pi-hole behaves as expected, as there is indeed no DNS record for gateway, only for gateway.home.thelinuxtraveler.blog (as explained):

If nslookup behaves differently on different machines, then its either not talking to Pi-hole, or it is configured differently, e.g. to not append a search domain for plain hostnames. Again, we can't be sure from the logs you've shared, as they do not match your nslookup commands. You may want to verify this in another set of lookups.
You then could address nslookup behaviour on the respective OS, but that wouldn't fix the missing DNS records for gateway.

Now, if you create additional DNS records for gateway, your clients would be able to resolve requests for gateway, regardless of their OS tool configurations.

Alternatively, you may want to consider my previous advice:

I did try removing the FQDN I created as the custom name in Pi-hole's DNS. I then added gateway and assigned the IP address to it.
I can now ping and look up gateway from the Ubuntu Server (frigg).
I was following a YouTube video that was using the FQDN instead of the hostname.

I see what you are saying now. I will go back and mark your previous message as the solution.

Writing the hostname in the custom DNS entry is much easier than the FQDN anyway.

Thank you for clearing this up. To quote the idiom. Can’t See The Forest For The Trees.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.