Unable to connect to http://pi.hole/admin

Hi All
I am quite new to raspberry pi and pihole and this is the first project i am using my raspberry pi 3B for.
I believe i've set up the pi hole successfully and it seems to be blocking ads correctly.

I can run the following commands:

pi@raspberrypi:~ $ pihole status
  [✓] DNS service is listening
     [✓] UDP (IPv4)
     [✓] TCP (IPv4)
     [✓] UDP (IPv6)
     [✓] TCP (IPv6)

  [✓] Pi-hole blocking is enabled

Running this on my PC:

curl -I http://pi.hole/admin/index.php
HTTP/1.1 200 OK
Set-Cookie: PHPSESSID=9j64ffmnopf1bbsa8dp38ucsk1; path=/; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-type: text/html; charset=UTF-8
X-Pi-hole: The Pi-hole Web interface is working!
X-Frame-Options: DENY
Date: Tue, 07 Sep 2021 13:04:20 GMT
Server: lighttpd/1.4.53

running this on my raspberry pi:

pi@raspberrypi:~ $ curl -I http://pi.hole/admin/
curl: (6) Could not resolve host: pi.hole

EDIT:
The pi.hole/admin webpage works for me! Except it seems to work on my phone and NOT my desktop, which is connected directly to my router via ethernet cable. So it seems like wireless connections to the admin page is successful. Is this some sort of setting in the router?

Expected Behaviour:

Able to visit the admin page

Actual Behaviour:

ERR_CONNECTION_RESET
Page doesnt resolve - times out and stops loading

Debug Token:

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

Thanks in advance
Oneiricer

The Pi does not appear to be using Pi-hole for DNS. Check the contents of /etc/resolv.conf to see which nameserver the Pi is using.

You can use this URL which will lead to the same admin page:

http://192.168.1.112/admin

Using http://192.168.1.112/admin results in the same issue - time out from my PC.

regarding checking the contents of /etc/resolv.conf - can you please provide exact instructions on how i can do this? Sorry I am very noob at bash/linux

From the Pi terminal, run this command - cat is the command to "concatenate files and print on the standard output"

cat /etc/resolv.conf

If the Pi is using Pi-hole for DNS, the output will typically look like this:

cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1

Run pihole -r and select the repair option.

Hi JFB,
Thanks for responding.
I've run the cat command and it returns:
8.8.8.8
8.8.4.4
Arnt these Google DNS servers?

Have also run the repair command.

Result still the same - can't access the admin page unless I'm on wireless network

Thanks
Oneiricer

This client is using the Google DNS servers and not using Pi-hole.

I see. So this is the raspberry pi that is hosting the pi hole service. Can it use itself for DNS settings?

Over on my PC (which cannot connect to the pi-hole admin) i've verified that it IS using the pihole as the DNS settings. I've even hard coded it into the windows network settings... but it is still timing out when i try to connect to http://pi.hole/admin.

Is there anything else I can do? Or do i need to fix this on the RP3 first?

thanks
Oneiricer

Yes. Set the nameserver on that device to 127.0.0.1

The Pi nameserver is independent of the Windows PC issue. From the PC, what is the output of the following from the command prompt?

ipconfig /all

Running ipconfig /all on my PC:

Windows IP Configuration

   Host Name . . . . . . . . . . . . : DESKTOP-ACH3QF9
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Ethernet Connection (12) I219-V
   Physical Address. . . . . . . . . : 24-4B-FE-93-E1-94
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::fde8:bd89:4a26:2620%13(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.105(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Wednesday, 8 September 2021 4:09:20 PM
   Lease Expires . . . . . . . . . . : Thursday, 9 September 2021 4:09:20 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 321145854
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-27-72-CF-1A-24-4B-FE-93-E1-94
   DNS Servers . . . . . . . . . . . : 192.168.1.112 
   NetBIOS over Tcpip. . . . . . . . : Enabled

192.168.1.112 <- this is the IP of my raspberry pi which is hosting the pi-hole. everything looks like it is in order here?

On the Raspberry pi, i've googled and run the following command:

sudo nano etc/dhcpcd.conf

and have edited out the google DNS and replaced with my own IP address.
Also rerunning the cat command you gave earlier confirms it is now 127.0.0.1.

Really appreciate your help here.

Oneiricer

edit: seperately i seem to be having an issue where on this PC, i get a black screen when i use VNC to connect to the raspberry pi. Other laptops that connect wirelessly to my network seem to be able to connect to the raspberry pi via VNC. The black screen i get is very strange as im not getting the video feed back, but the mouse and keyboard still work (just can't see anything).
Im starting to think there is something that is seperating the network between ethernet and wireless via my router, even though both my PC and the raspberry are connected directly to my router via ethernet.

Hi JFB,
Just checking if you have any other ideas. Much appreciated for you help so far.
thanks
Oneiricer

Since when are you guys instructing to apply Pi-hole on its own host as DNS resolver? The installer does not do that anymore for reasons, it doesn't make any sense on a server and causes potential issues. Google DNS was pretty fine :wink:.

@oneiricer
Check on the Windows client which DNS it factually uses:

nslookup pi.hole

Since the OP asked how to do this. It is not something that our installer does, but there may be valid reasons for a user wanting the Pi-hole host to use Pi-hole for DNS.

I think it was only a misunderstanding due to the additional curl ran on the Pi while the actual issue is that the admin panel is not reachable from the Windows client via pi.hole.

As of the curl @oneiricer: Since pi.hole is only resolved by Pi-hole itself, it is expected that you cannot use that domain one the Pi-hole host itself by default, but only on the clients. Doing the change to /etc/resolv.conf enables it on the server, but it implies the risk that it locks out itself during maintenance tasks or when Pi-hole crashes for some reason. And as long as you don't run a GUI browser on that server, you won't be bothered by ads there :slightly_smiling_face:.

Thanks for clearing thatr up MichaIng. I will change it back to Google DNS settings.

Running the nslookup pi.hole command returns the following results:

Server: raspberrypi
Address: 192.168.1.112

Name: pi.hole
Address: 192.168.1.112

Could it be something to do with ad-block on chrome? I've tried connecting to p.hole via incognito and also on edge (a browser that i dont normally use) but they both get the time out error.
thanks
Oneiricer

So the system resolver uses Pi-hole.

Probably Chromium based browsers use DoH (DNS-over-HTTPS) automatically in incognito mode, or it is enabled in general, which bypasses the system resolver. Worth to have a look into the settings.

Interestingly I use chrome on both my mac book and another windows laptop which connect successfully to pi.hole. Both of these machines are connected to the router wirelessly. It is only my windows PC (the main one i use) which cannot seem to connect.

Just confirming on my main windows PC, if i switch off ethernet and turn on wifi for my PC, it is now able to connect to pi.hole/admin...
so it is not related to the browser.

This sounds like a problem with either the router or Windows.

For Windows 10/11 there should be a generic recommendation to refresh the ip config with:
ipconfig /renew
That forces the new settings to be active.