pi-hole / pi-hole

A black hole for Internet advertisements

Home Page:https://pi-hole.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't resolve .local TLD defined in DNS Records from MacOS or iOS

HVR88 opened this issue · comments

  • This issue seems to only affect .local (and .onion) names defined in the pi-hole DNS Records page
  • It doesn't seem to affect other custom TLDs like .lan or .whatever or .scooby
  • .local names that are broadcast by their respective devices also work as expected

Versions

Pi-hole version is v5.18.2 (Latest: v5.18.2)
web version is v5.21 (Latest: v5.21)
FTL version is v5.25.2 (Latest: v5.25.2)

Platform

  • OS and version:
    OS: Debian GNU/Linux 12 (bookworm)
    Kernel: Linux 6.6.20+rpt-rpi-v8
    Arch: arm64

  • Platform:
    Raspberry Pi 4b

Expected behavior

Local DNS Records created in PiHole with .local TLD cannot be resolved.

Expectation: Record resolved at pi-hole, not sent upstream

Example:
myserver.local 192.168.8.2 defined in pi-hole's DNS record page

In the conf file it's listed as 192.168.8.2. myserver.local

When I type http://myserver.local into a web browser I expect to be served the page on my local server at http://192.168.8.2

Actual behavior / bug

http://myserver.local cannot be resolved in any browser on MacOS or Safari in iOS and generates an error - tested from multiple Windows 10 and 11 machines using Firefox and it works

According to pi-hole's query log, the query shows up as www.myserver.local and is passed to upstream DNS (quad9 in this case)

The log for the visits by Windows machines show myserver.local without the www and is not passed upstream

Other local and defined TLDs work correctly and as expected, such as .lan, .whatever

Only ONE domain definition is being tested at one time, there are never multiple names assigned to one IP and the definition is deleted every time another one is to be tested

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to pi-hole admin UI
  2. Click on Local DNS left-menu
  3. Click on DNS Records item under the above menu
  4. In the Local DNS Records page, type "myserver.local" into the domain name and a local IP with a valid page at port 80 into the IP Address text box
  5. Click the Add button and verify that the entry now appears below in the List of Local DNS Domains
  6. In a browser address bar (Safari, Floorp, Firefox, Chrome tested), type http://myserver.local and press Return/Enter
  7. Error, can't find site/page in MacOS or iOS

Debug Token

Screenshots

These three show the problem with .local on a Mac

Screenshot 2024-05-16 at 4 52 48 PM

Screenshot 2024-05-16 at 4 53 48 PM

Screenshot 2024-05-16 at 4 53 28 PM

And these three show .lan working correctly on the same Mac

Screenshot 2024-05-16 at 4 52 31 PM

Screenshot 2024-05-16 at 4 52 04 PM

Screenshot 2024-05-16 at 4 52 18 PM

Additional context

  • Eero 6 Pro router with active DHCP
  • pi-hole IP is assigned as the only DNS at the router level
  • Mac is using only the pihole IP for DNS
  • There is no secondary or additional DNS on router or Mac (no "round-robin" no "fastest response" issue)
  • Mac has no firewall active
  • iCloud Private Relay is OFF
  • .local addresses that are broadcast by their respective devices resolve correctly (example: unraid.local, raspberrypi.local)
  • nslookup works correctly by both name and IP
  • ping does not work to the myserver.local name but works fine for myserver.lan or myserver.whatever
  • clearing DNS cache on MacOS doesn't have any effect
  • None of the google results for pi-hole Mac issues seem applicable (typically ppl were running multiple DNS or problem only happened in Safari)
  • IPv6 disabled on router during testing
  • no IPv6 upstream DNS selected in pi-hole

It seems your Mac browser is silently adding www. to the domains you requested. As it is listed in the query log, the domain Pi-hole received is www.myserver.local and not myserver.local. As it does not know www.myserver.local it sends the request upstreams. Check your browser settings for an option to disable that behavior.

That's not it.

It's happening regardless of the browser used and none of the browsers display any "www" in their address bars or logs. It's also not happening if the TLD is literally anything else, like .lan or .lame or .whatever

And it's not happening on Windows with the same browsers.

For giggles I added the following to the DNS:

www.myserver.local myserver.local
myserver.local 192.168.8.2

It doesn't work when going to http://myserver.local but works correctly when going to http://www.myserver.local

And this also works for www but not without:

www.myserver.local 192.168.8.2
myserver.local 192.168.8.2

As .lan hasn't yet been adopted, I'll resort to co-opting some other recognized TLD for my local servers, like .us or .app

.local is typically advertised by the host and resolved with bonjour/mdns. As I've looked into it, the issue also persists with Adguard Home, so it doesn't look like it's pihole specific.

At the end of the day, it doesn't look like .local can ever be handled consistently by a DNS resolver like this - it needs to be multicast as that TLD is reserved for it. In other words, it shouldn't be used in DNS records.

https://en.wikipedia.org/wiki/.local

Issue closed.