Add CNAME record support to Pi-Hole 5's Local DNS Records

I originally posted this feature request as an issue on GitHub before being directed to the Pi-Hole Discourse.

First off, I'm really liking my short time with Pi-Hole so far. I installed version 4 a couple of days ago, liked what I saw, but thought it was bit of a shame not having GUI access for creating local DNS records. Then I upgraded to version 5 beta, and I see the GUI now provides the ability to add custom A records, for mapping domains to IPs. Awesome! Great work devs!

However, I'm sure I'm not the only user who likes to also use CNAMEs on their home network to map user friendly domains to less friendly but more infrastructure organised internal names. For example, I might map git.mydomain.tld to things like git-vm-20200215.mydomain.tld so that I can swap between VMs with unique hostnames whilst all clients just carry on using git.mydomain.tld like nothing is different.

I am aware I could achieve the same end result with A records, but CNAMEs allows me to use DHCP on the VMs, with no need to be aware of any IPs. Lovely!

Is this something that other users would like to see? Are there any plans to implement CNAMEs in the Local DNS Records page?

Thanks!

This can be done with dnsmasq configuration files in folder /etc/dnsmasq.d

Thank you for the reply. I have been using dnsmasq configs to do this on my existing setup and happy to continue doing so on Pi-Hole too. However, I do think it would be a nice addition to the Local DNS Records page in the Web GUI.

1 Like

I'd like this feature as well. Besides ease of use, when I backup pi-hole using Teleport, the DNS aliases would also be backed up. A work around is to backup the entire pi-hole host server, so that you don't miss important files like customized /etc/hosts.

Teleporter exports /etc/hosts, along with any configuration files in /etc/dmsmasq.d

Will be included in v5.1

There is a PR in the pipline that adds CNAME support to pihole

Thanks for the link to that PR, yubiuser. I had been gearing up to work on it myself so I'm happy to see that before I got stuck in. Looking forward to seeing it merged to master. :slight_smile:

Implemented with Pi-hole Core/Web v5.2 and FTL v5.3 released!