Pi-hole, Conditional Forwarding, and Unifi Networking

In my start of the year post, I had given up with attempting to get Pi-hole to work as a DHCP server while in a docker container and had started using “isc-dhcp-server”. The main driver to having Pi-hole performing DHCP was so that in the dashboard I could see actual hostnames as opposed to the IP addresses of the clients. Instead of persevering with trying to get DHCP working in the Pi-hole container, I took advantage of changes I was making in my home network setup.

Since writing that post I have set up some new Ubiquiti kit for running parts of my home network. The main components of my home network now consists of:

Since getting the USG, I have switched over to performing DHCP on it instead of my home server. This setup is still notifying clients to use the Pi-hole as the DNS server.

This change alone was not going to get Pi-hole to display client names, two more changes were needed:

  • in the Pi-hole DNS settings, turn on conditional forwarding pointing back to the IP address of the USG for the local domain in use.
  • in the docker container configuration add configuration for “dns” pointing to This is now the recommended setup in the Pi-hole docker documentation as of version 4.1.1 onwards so I won’t repeat the steps here.

Now I can see proper device hostnames. There is one ongoing issue however - I had changed the domain name for the network in the USG configuration but reverse DNS lookups still resolve hostnames with the default “.localdomain” instead of my configured domain name. This means that Pi-hole will also show hostnames ending with “.localdomain”. This does only appear to be an issue with reverse lookups, regular DNS lookups do resolve on the correct domain name. I am still looking in to this part, but getting any sort of hostname is a plus.

It is worth noting that I could not have used conditional forwarding when I was using the ISC DHCP Server as it does not include a DNS component. I would have had to run a Bind instance along side it as the DHCP server can perform dynamic DNS updates, but dnsmasq (which backs Pi-hole) does not support being updated in this way.