Local Server losing DNS name on PiHole network?


I have two Raspberry Pi 3b+ running PiHole. I also have a Pi400 running Home Assistant. I have plenty of configuration that refers to that Home Assistant server as hasta.lan. The issue I have is that the hasta.lan name becomes unavailable often. Approximately every day or two. All three Raspberry Pi are using wired networking, not wifi. When it happened today, I rebooted the home assistant server, and within 5 minutes, Home Assistant was running ant the hasta.lan name worked. I can always still use the IP address when the name is not available, but I would prefer to use the server name in the config , and fix this name disappearing issue.

Is there something I should look at to see why this might be happening in order to fix it?

Thanks for your help

Where did you define that name?

I entered hasta as the name for that mac address in the dhcp reservations in pihole. The pihole domain name is "lan".

I figured it out, and will leave the answer here in case it helps someone else.

Both of my pihole servers have DHCP lease configured for all local devices. This allows you to map the MAC address to an ip address, and/or a name on the local domain. The issue is that when you have two pihole servers, the device will get the an active DHCP lease from the first pihole to respond. But the other pihole server does not know that the lease is active. If you have a client that is getting DHCP information from that Pi-Hole server that is not aware of the active lease, it will respond that the DNS dame does not exist.

There is an easy fix. Do not bother putting device names in the DHCP reservation table. Instead, put the name in the Local DNS > DNS Records section. These are remembered by both RaspberryPi servers at all times.

I had a theory that the issue came from only one Raspberry Pi knowing that the DHCP lease was active. To test this hypothesis, I ran the following from Powershell:

resolve-dnsname -Name hasta.lan -Server Piholea
resolve-dnsname -Name hasta.lan -Server Piholeb

The result was that one returned the IP address of hasta.lan, the other stated the "DNS name does not exist". I put the name in the local DNS section in PiHole for both Pihole servers, and immediately, running the above test again resulted in a correct IP response from both pi-Hole servers.

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