Questions about local hosts, local domains

Hi, I've been using Pi-Hole for quite a while now.

I've updated my RPi2 to Pi-Hole v5 yesterday. Long story short, the update kind of failed at first try because I was still running Raspbian Jessie (which is not supported). I tried doing a full live update from Jessie to Buster but it kind of pooped on me. So I just started with a fresh install of Buster and PiHole.

Everything is back to normal. However I have a few questions:

  • In v4, I got used to access my local computers (VMWare ESXI admin panel, Synology Admin, etc) by their hostname.local address. If I remember correctly, all I had to do was to assign a static local IP and host name in DHCP and I was good to go. I've noticed that default Pi-Hole domain name was "lan" so I've set it to "local" (which I'm used to). Everything seems to work however, VMWare Admin (hostnmame "esxi") just won't load when I type esxi.local in firefox. When I enter the IP it works though. Should I do something else.

  • I have a local bitwarden server that is served to the internet via nginx. I have nginx set up to reverse proxy it to the right machine using the friendly address (hostname.local). Won't work anymore, I had to put the exact ip address. I don't understand why.

  • Finally I've seen the v5 allows for Local DNS record. Should I use that to locally serve my bitwarden ? I kind of feel that nginx already handles that right

Using .local as your local DNS domain name may work in your network, but I'd advise against using it in general, since .local is the default domain name used by mDNS, as implemented e.g. by Apple's Bonjour or Linux' avahi software (recent Windows and Android versions have mDNS support as well)

This also means an mDNS-aware OS will be able to resolve .local domains regardless of any DNS server's presence, e.g. I can ping my RPi as raspberrypi.local though my local domain name is fritz.box (but can't do so from a Win7 client). Note that an mDNS hostname does not necessarily match the name of the device your DNS is aware of, especially if you've configured a custom name in Pi-hole or your router.

The question that springs to mind then:
In your previous installation, did Pi-hole act as DHCP server and distribute .local as domain name, or have you perhaps been relying on mDNS name resolution all the way in the past?
(Unlikely if you have been using Win7 clients).

To rule out potential interferences from mDNS, I'd recommend to use Pi-hole's default .lan name or anything else but .local and see if that works.

DNS provides hostname resolution, nginx doesn't.

Whenever you want an IP address to be associated with a specific hostname, you'd want to create a respective DNS record, e.g. by using Pi-hole's Local DNS record UI.

Thanks @Bucking_Horn

It turns out, I'm mainly using Apple computers on my networks. Given your explanation, this may explains why I'm able to resolve my networks computer simply with their "official" hostname (not the one in Pi-Hole) and .local. But nginx won't because is it not an apple machine and can't implicitely resolve that.

In your previous installation, did Pi-hole act as DHCP server and distribute .local as domain name, or have you perhaps been relying on mDNS name resolution all the way in the past?

Probably a bit of both. Since I screwed up my update and had to start from scratch, I don't have a backup of my previous instalation to check this.

So I've changed back the hostname from .local to .lan and... it seems to works from my computer.
I still have to check everything but it seems more straightforward today than it was yesterday. I may have run into trouble yesterday as I had devices still on their previous DHCP lease and weren't properly able to resolve local queries.

EDIT : side question, how can I set up pi-hole own local name. My apple computer can resolve pihole.local (pihole is the hostname of my Rpi, and .local you've already explained that). Is there a way to set it up to resolve something like pihole.lan and use it to go to the admin for example : pihole.lan/admin

Normally, your router (more exactly, your local DHCP server) would set and distribute a local domain name (aka search suffix).
Hence, it would depend on the DHCP server whether it allows to change that name (e.g., my FritzBox router doesn't, but Pi-hole does).

Most DNS using clients will try to resolve hostnames directly (i.e. raspberrypi) as well as by appending it by the local domain name (i.e. raspberrypi.lan or raspberrypi.fritz.box), so just setting a hostname should be enough.
In your specific case, it means pihole.<your-local-domain-name-here>/admin should work straight away, as long as Pi-hole is aware of pihole as a hostname. If it isn't, you'd have to create a local host record for pihole.

If that doesn't work for some clients in circumstances, you may also define a respective local DNS record for a FQDN name (e.g. pihole.lan). That should work as well, but be prepared to see DNS queries for hostnames like pihole.lan.lan or pihole.lan.fritz.box in Pi-hole's Query Log, depending on your local search suffix.

Edit:

Chances are that's running on Linux.
So if you are keen on mDNS, you could try to get Avahi installed on that.machine.

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