Docker Pi Hole - Local DNS not used for browser or ping requests

Versions

  • Pi-hole: 5.2.2
  • AdminLTE: 5.2.2
  • FTL: 5.3.4

Platform

  • OS and version:
  • Raspbian 10
  • Platform: Docker on Raspberry Pi

PiHole is configured as the DNS Server in the DHCP configuration settings in my Router which is a TP Link Archer C7, so
DNS Server for LAN -> Raspberry Pi local ip address / Configured at Lan DHCP Settings in Router
DHCP Server for LAN -> TP Link Archer C7

Local DNS entries added to Pi-Hole should resolve correctly with all protocols, including when I try to access them through a Browser.
So, for example I added a Local DNS in Pi Hole for the Raspberry Pi that is hosting the docker container with it:
PiHole - 127.0.0.10

When I ping PiHole using cmd, I don't get it resolved, and when I try to access it in a browser with http://pihole/admin it doesn't connect.

If I use nslookup PiHole, it gets resolved correctly and it shows the Pi IP as the DNS Server (as it should be)

However, if I ping or browse the hostname that is shown in the Router's DHCP configuration, it gets resolved with an IPv6 address and it also works Browsing it.
So, for example, the hostname for the raspberry pi in the DHCP configuration shows as "raspberrypi"
If I ping raspberrypi, it resolves correctly, and if I browser http://raspberrypi/admin, I can access the PiHole admin console

I understand ping and nslookup resolve differently, but why like this, why one uses the DNS and the other uses the DHCP local entries, and why does browsing also works using DHCP?
Is there anyway of changing this?
I lack any almost any kind of network knowledge

Are you running these commands all from the same client? Please post the complete outputs of each command.

Yes, I'm running it from the same client.

nslookup

Default Server:  pihole
Address:  192.168.1.159

> pihole
Server:  pihole
Address:  192.168.1.159

Name:    pihole
Address:  192.168.1.159

ping pihole

Ping request could not find host pihole. Please check the name and try again.

Browser firefox, address http://pihole/admin:


Hmm. We’re having trouble finding that site.

We can’t connect to the server at www.pihole.com.

If that address is correct, here are three other things you can try:

    Try again later.
    Check your network connection.
    If you are connected but behind a firewall, check that Firefox has permission to access the Web.

The browser problem also happens when I try to do it from an Android Phone

Why aren't you using the default pi.hole?

http://pi.hole/admin

Or ping pi.hole

That address will only work inside the docker network. That's not the address you'd put on clients to use.

as for pi.hole, I just modify it to be related to the naming convention of my home network.

As for the Ip, that's not the actual IP, it was just an example, and a bad one.
The current IP for the Raspberry Pi is within the LAN, which is 198.162.1.0/25

Where do you have this domain name mapped to an IP?

After digging up a lot of things, I found out the issue is related to how Windows and Windows Browsers resolve ping requests.
For all devices except the raspberry pi, I needed to add a dot "." at the end of the ping request so, instead of ping hostname
it needs to be
ping hostname.

As for the raspberry pi DNS record set in the Local DNS setting, it needs to have a FQDN name to get resolved both by ping and browser http requests, so, instead of
Piholedevice 192.168.1.10
it needs to be
Pihole.device 192.168.1.10

I hope this helps anyone with the same issue/query

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