PiHole resolving TrueNAS FQDN as 127.0.0.1

I am running TrueNAS TrueNAS-SCALE-23.10.2 with a few apps. One of those apps is Pi-Hole 2024.03.2 . I am also sharing samba file storage from my TrueNAS. The machine’s FQDN (replacing my domain name) is docking.domain.tld. My domain DNS servers are hosted offsite with my hosting company. I have file shares on the TrueNAS. The issue is I can not get to those shares if I use Pi-Hole as my DNS. If I use any other DNS server and do a lookup it shows the correct internal IP address. However Pi-Hole responds with 127.0.0.1. Checking it is pulling it from the TrueNAS hosts file which has 127.0.0.1 listed for the FQDN and shortname. I am unsure how to correct this as the /etc/hosts in TrueNAS is not persistent.

From the pi-hole log:
Apr 28 01:25:59: query[A] docking.domain.tld from 192.168.5.11 Apr 28 01:25:59: /etc/hosts docking.domain.tld is 127.0.0.1

From MXToolBox

Is your publicly available domain pointing to the internal IP?

Usually you would add local DNS entries in pihole that resolve the domain.

The public record has entries for local entities like TrueNAS. if you did a dig against a public DNS server for docking.domain.tld it would respond with the internal 192.168.5.X IP address.

According tot he PiHole the /etc/hosts, which is exported from TrueNAS by Kubernetes, takes precedence over local entries added to it.

From PiHole:
Note:

The order of locally defined DNS records is:

  1. The device’s host name and pi.hole
  2. Configured in a config file in /etc/dnsmasq.d/
  3. Read from /etc/hosts
  4. Read from the “Local (custom) DNS” list (stored in /etc/pihole/custom.list)

Only the first record will trigger an address-to-name association.

Sorry forgot, here is the /etc/hosts file from TrueNAS and is exported to the containers…

user@docking:~$ cat /etc/hosts

127.0.0.1	docking.domain.tld docking
127.0.0.1	localhost

# The following lines are desirable for IPv6 capable hosts
::1	localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

# STATIC ENTRIES
user@docking:~$ 

I have a temporary hack in place. In TrueNAS I set the hostname to dock instead of docking but left my DNS entry as docking.domain.tld. This is not a good hack thought and this makes me worry if other containers could be effected by the /etc/hosts file using localhost instead of the actual IP.

Did you try adding a local entry in the web UI?