Categories
Configuration Tips

Configuring Pi-hole to Resolve Domains to Internal IP

When using Cloudflare DNS entries for reverse-proxy hostnames those hostnames will resolve to the Cloudflare IP, but inside the home network they should resolve to the internal server IP.

When using Pi-hole as the internal DNS server you can customize the IP returned for domains/hostnames by doing the following.

First, create a custom configuration file to tell dnsmasq where to find additional hostname information for the LAN:

$ echo "addn-hosts=/etc/pihole/lan.list" | sudo tee /etc/dnsmasq.d/02-lan.conf

Next, create /etc/pihole/lan.list with lines with the format ipaddress hostname [hostname]...

192.168.1.75 ombi.mydomain.com tautulli.mydomain.com mediaserver

Finally, restart the Pi-hole DNS server:

$ sudo pihole restartdns