Unable to access Raspberry Pi homepage by domain on iPhone

to work around your IPhone, you could create a local DNS record inside PiHole for raspberrypi pointing your RPI device.

Still failed

My guess is the apple private relay forces your phone to use apples DNS servers instead of your loca one.

I tried also to add other domains like Test with same IP. That doesn’t work on any devices, no even my computer.

Domain : Test
IP : 192.168.1.108

Unable to surf http://Test and unable to ping Test
There might be some other settings to put in Pi-Hole that I’m not aware of.

from what system you do these test?

Theoretically we could install tcpdump to check what happen and if request are received on PiHole side. As well you could check PiiHole logs to see what happen.

I forgot to try from ping from my raspberry pi!
If I ping from raspberrypi (open ssh session to do ping), I got reply but if I ping from any of my 2 PC I get :
Ping request could not find host nas. Please check the name and try again.

I’m thinking either it’s unbound installed with pi-hole or my settings that I have to change.

If you are on Windows, you can do following within cmd window:

nslookup <your_host_name>

C:\Users\Stephane>nslookup
Default Server: pi.hole
Address: 192.168.1.108

C:\Users\Stephane>nslookup nas
Server: pi.hole
Address: 192.168.1.108

Name: nas
Address: 192.168.1.108

DNS resolution is working fine acording this.

I made another test with an interesting discovery!

If I create a domain called portainer then I can’t access the local server on my browser

If I create a domain called rpi.portainer then I can access the local server on my browser

Is there a way to create a local domain without .whatever and it will work on my browser like http://domain?

For the ping tests (Windows 10)

C:\Users\Stephane>ping portainer
Ping request could not find host portainer. Please check the name and try again.

C:\Users\Stephane>ping rpi.portainer

Pinging rpi.portainer [192.168.1.108] with 32 bytes of data:
Reply from 192.168.1.108: bytes=32 time<1ms TTL=64
Reply from 192.168.1.108: bytes=32 time<1ms TTL=64
Reply from 192.168.1.108: bytes=32 time<1ms TTL=64
Reply from 192.168.1.108: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.108:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Well, it’s a normal behavior. Windows is adding the local domain name to your ping request if there is no other domain inside the address/request. Therefore, it is not working the way you tried.

Let me try to explain. Usually, the local domain record is assigned by your DHCP server to your DHCP client. You can check it on Windows using ipconfig. It will show the DNS-Suffix. In my case it is lan

C:\Users\>ipconfig

Windows-IP-Konfiguration

Drahtlos-LAN-Adapter WLAN:

   Verbindungsspezifisches DNS-Suffix: lan
   IPv4-Adresse  . . . . . . . . . . : 192.168.0.92
   Subnetzmaske  . . . . . . . . . . : 255.255.255.0
   Standardgateway . . . . . . . . . : 192.168.0.1

C:\Users\>

For testing I installed a fresh PiHole and tcpdump tool to be able to trace network traffic. Inside PiHole I created a new local DNS record for host raspberry.

Trying to ping the host raspberry will result in same error as your test.

C:\Users\>ping raspberry
Ping-Anforderung konnte Host "raspberry" nicht finden. Überprüfen Sie den Namen, und versuchen Sie es erneut.

C:\Users\>

In parallel I was doing some network trace on the test system hosting PiHole

21:45:53.149163 eth0  In  IP 192.168.0.92.65510 > 192.168.0.17.53: 63579+ A? raspberry.lan. (31)
21:45:53.150055 eth0  Out IP 192.168.0.17.46212 > 8.8.4.4.53: 12455+ A? raspberry.lan. (31)
21:45:53.166577 eth0  In  IP 8.8.4.4.53 > 192.168.0.17.46212: 12455 NXDomain 0/1/0 (106)
21:45:53.166852 eth0  Out IP 192.168.0.17.53 > 192.168.0.92.65510: 63579 NXDomain 0/1/0 (106)
21:46:03.041118 eth0  In  IP 192.168.0.92.65510 > 192.168.0.17.53: 5697+ A? NPIA60B4F.lan. (31)
21:46:03.041493 eth0  Out IP 192.168.0.17.53 > 192.168.0.92.65510: 5697 NXDomain 0/0/0 (31)

You see, my Windows box (192.168.0.92) is asking test PiHole system (192.168.0.17). But the Windows box is not asking for host raspberry but for raspberry.lan. :wink:

Windows has added DNS-Suffix: lan to the host name request. As this one is unknown to PiHole, query is forward to upstream Google DNS server 8.8.4.4. At the end it is resulting in an unknown domain NXDomain. That’s why you get the unknown host message in your ping test.

To work around, you need to add local DNS record raspberry.lan instead of raspberry

This way, ping is working fine on Windows

C:\Users\>ping raspberry

Ping wird ausgeführt für raspberry.lan [192.168.0.11] mit 32 Bytes Daten:
Antwort von 192.168.0.11: Bytes=32 Zeit=4ms TTL=64
Antwort von 192.168.0.11: Bytes=32 Zeit=4ms TTL=64

Ping-Statistik für 192.168.0.11:
    Pakete: Gesendet = 2, Empfangen = 2, Verloren = 0
    (0% Verlust),
Ca. Zeitangaben in Millisek.:
    Minimum = 4ms, Maximum = 4ms, Mittelwert = 4ms

tcpdump is showing correct trace as well

22:09:08.954224 eth0  In  IP 192.168.0.92.65208 > 192.168.0.17.53: 61137+ A? raspberry.lan. (31)
22:09:08.955081 eth0  Out IP 192.168.0.17.53 > 192.168.0.92.65208: 61137* 1/0/0 A 192.168.0.11 (47)

And finally, I’m able to reach a web site using http://raspberry:8080/

Hope this make your situation a little bit more clear :slight_smile: