With a little configuration, you can use your pi-hole as the DNS server for your LAN, if, for example, your router isn’t doing a very good job serving local names. Here’s how:
Create a second dnsmasq configuration file:
% echo "addn-hosts=/etc/pihole/lan.list" | sudo tee /etc/dnsmasq.d/02-lan.conf
% is for whatever your system prompt is; don’t type it out )
After this, create a “hosts file” for your network
/etc/pihole/lan.list with the format
ipaddress fqdn hostname, eg
192.168.1.40 marvin.your.lan marvin 192.168.1.41 eddie.your.lan eddie 192.168.1.42 hactar.your.lan hactar
…substituting “your.lan” for whatever you want your domain name to be.
On your DHCP server (most likely your router, though pi-hole indeed can be configured into one), you’ll also need to set your search domain to whatever “your.lan” corresponds to.
Finally, restart your name server:
% sudo service dnsmasq force-reload
- If all this domain name stuff confuses you, you can leave it out and live a domain-less life on your LAN.
- While you certainly can serve any name, also of hosts outside of your LAN, you probably can’t outsmart Netflix to play shows from outside your geographical area . Drop that thought. It’s probably against their TOS and you might end up losing your Netflix account.
dnsmasqmanual page suggests the configuration option
hostsdir, but this didn’t work on my raspi. Possibly i was just incompetent.