Local DNS records
Advanced Configuration
Local DNS records in Pi-hole allow you to create custom hostname-to-IP address mappings for your local network. Let me explain their key uses and benefits:
Main Uses of Local DNS Records
Custom Device Names
- Map friendly names to local IP addresses (e.g.,
printer.local→192.168.1.50) - Access devices by name instead of remembering IP addresses
- Map friendly names to local IP addresses (e.g.,
Internal Services
- Create shortcuts to local services (e.g.,
nas.home→192.168.1.100) - Access internal websites using custom domains
- Create shortcuts to local services (e.g.,
Development Testing
- Point domains to local development servers
- Test websites locally before deployment
Common Examples
# Basic local DNS record examples
printer.local → 192.168.1.50
nas.home → 192.168.1.100
homeserver.local → 192.168.1.150
dashboard.local → 192.168.1.200
Benefits
Simplified Access
- Use memorable names instead of IP addresses
- Easier sharing of network resources
Network Organization
- Better organization of network devices
- Simplified network documentation
Stability
- Services remain accessible even if IP addresses change
- Works offline, independent of internet connectivity
Security
- Keep internal services private
- Avoid exposing internal IPs to external DNS servers
Setting Up Local DNS Records in Pi-hole
Method 1: Using Pi-hole Web Interface
- Access Pi-hole admin interface (http://pi.hole/admin)
- Navigate to "Local DNS" → "DNS Records"
- Add new entries:
- Domain: Enter the hostname (e.g., printer.local)
- IP Address: Enter the corresponding IP (e.g., 192.168.1.50)
- Click "Add"
Method 2: Manual Configuration File
- SSH into your Pi-hole
Edit the custom DNS configuration file:
sudo nano /etc/dnsmasq.d/02-custom.confAdd entries in this format:
address=/hostname.local/192.168.1.50 address=/another.local/192.168.1.51Save the file and restart DNS service:
sudo pihole restartdns
Example Configurations
Basic Records
# Network devices
address=/printer.local/192.168.1.50
address=/nas.local/192.168.1.100
address=/router.local/192.168.1.1
# Internal services
address=/plex.home/192.168.1.150
address=/homeassistant.local/192.168.1.160
address=/dashboard.local/192.168.1.170
Advanced Configurations
CNAME Records
# Point multiple domains to same IP
cname=media.local,plex.home
cname=movies.local,plex.home
Wildcard Domains
# Match all subdomains
address=/*.test.local/192.168.1.200
Verification and Testing
Test DNS resolution:
ping printer.local nslookup nas.localCheck Pi-hole logs:
pihole -t
Troubleshooting
Common Issues
Name Not Resolving
- Verify DNS record exists
- Check spelling and format
- Ensure Pi-hole is primary DNS server
Conflicts
- Check for duplicate entries
- Verify no conflicts with external DNS
Cache Issues
- Clear Pi-hole cache:
bash pihole restartdns flush - Clear device DNS cache
- Clear Pi-hole cache:
Best Practices
Use Consistent Naming
- Choose a naming convention (.local, .home, etc.)
- Document all custom records
Regular Maintenance
- Review and update records regularly
- Remove obsolete entries
- Backup configuration
Security Considerations
- Use internal-only TLDs (.local, .home)
- Avoid using public domain names
- Document access methods
Backup and Recovery
Backup custom DNS configurations:
sudo cp /etc/dnsmasq.d/02-custom.conf /backup/Export Pi-hole settings:
- Use teleporter feature in web interface
- Save configuration files
Something here not working for you? Ask in the community — other makers and the Little Bird team read it.