Pi-hole’s "Local DNS Records" feature lets you define your own DNS entries for devices on your local network, overriding any external DNS lookups.
Here’s Pi-hole serving a local DNS record in action:
Imagine you have a Raspberry Pi running a web server at 192.168.1.100. You want to access it simply by typing myraspberrypi.local in your browser, instead of remembering the IP address.
In your Pi-hole’s web interface, navigate to Local DNS > DNS Records.
You’d enter:
- Domain:
myraspberrypi.local - IP Address:
192.168.1.100
Now, when any device on your network queries Pi-hole for myraspberrypi.local, Pi-hole will directly return 192.168.1.100 without asking any upstream DNS servers.
This is incredibly useful for accessing internal services like NAS devices, home automation hubs, or development servers. You can even use it to block specific local hostnames if you want.
The system works by maintaining a local database of these custom domain-to-IP mappings. When a DNS query arrives, Pi-hole first checks this local database. If a match is found, it immediately serves the associated IP address. If no match is found, it proceeds with its normal DNS resolution process, forwarding the query to your configured upstream DNS servers.
The key configuration levers are the Domain and IP Address fields in the UI. The domain name should follow standard DNS naming conventions, and the IP address should be a valid IPv4 or IPv6 address. Pi-hole also supports wildcard entries in the domain field (e.g., *.local would match anyname.local), though this is less common for specific device mapping.
For more advanced scenarios, you can also define "CNAME Records" under Local DNS > CNAME Records. This allows you to create aliases. For instance, if you have a device at 192.168.1.50 named printer.local, you could create a CNAME record mapping print.local to printer.local. This means querying for print.local will resolve to the IP address of printer.local.
Most people configure Pi-hole to block ads by simply adding blocklists. However, the ability to serve local DNS records is a powerful extension of its DNS capabilities, turning it into a miniature internal DNS server for your home network. It’s not just about blocking; it’s about controlling and customizing your network’s name resolution.
The next natural step after setting up local DNS records is to explore how Pi-hole’s Conditional Forwarding feature can help resolve local hostnames from your router.