Recently, I had been considering moving my local dns service from Pi-hole to AdGuard Home. This was primarily for the parental controls that it offers, but the second most compelling reason to consider switching was the ability to have a wildcard DNS record that pointed all subdomains to a single reverse proxy. In the end, I decided to use both because theres a lot to love about both. That being said, I have recently learned that the wildcard record can also be done on Pi-hole as well. Athough it’s not quite as simple as AdGuard Home, it is easy enough to do. After to you log in to your Pi-hole just follow these simple steps.
From the dashboard navigate to the setting menu
Enable expert mode by clicking on the basic button
This can be done in any settings tab. Since I am using the Star Trek LCARS theme this button is located on the upper left of the screen but on any of the other themes it’s on the right. Just look for the word basic.
Enter the All Setting area
Check if you are in the modified settings area
If you see this blue modified settings button you can scroll down to the bottom of the page and proceed the the final step. Again the button is on the left side for the Star Trek theme and on the right for any other.
If instead you see a green all settings button and a series of settings tabs you can either, click the all settings button to go to the modified settings area and scroll to the bottom or click on the Miscellaneous tab as shown below.
Add dnsmasq entry
Look for the misc.dnsmasq_lines settings box. It is on the very bottom of the modified settings area or third down on the right of the Miscellaneous area. In here you add the line:
address=/yourdomain.com/192.168.1.1
In this screen shot you can see that I changed the domain to hwhl-demo.xyz and the IP address to that of my reverse proxy, which is running at 192.168.240.162. Now don’t forget to hit save and apply. With this one little line, depending on your homelab habits, you should never need to enter another local DNS record again. In my case .hwhl-demo.xyz will always send traffic to my reverse proxy. I love that I will only ever need to ensure that reverse proxy is configured. Plus you can fully automate the reverse proxy configuration if you are using traefik (and apparently caddy but i’ve never tried it) using labels with docker. But that’s for another time.
That’s all there is to it for a wildcard dns on Pi-hole. I hope this helps you as much as it for me. And seriously, keep having fun with your homelab!