HOWTO: Using pi-hole as LAN DNS server


Let me add a little hint. If you manually add your local hosts to /etc/hosts it will not work as expected, because these two default entries: localhost pihole

break the configuration for details - the local hosts cannot be resolved. This issue should be fixed.


I know this is an old post but I just stumbled upon this. This 2nd option is fantastic! I had no idea it was possible. This makes the Top Clients section so much more easily readable. :+1: Any downsides at all to using this option?



If you have only set up one upstream DNS server (your router under one of the “Custom” fields), you’ll be fine. If you have enabled another upstream DNS server along your router (e.g. Google), this one will receive all your requests as well. Note that this could potentially be a privacy issue, if you have host names like contain plain text information or other sensible information.


yeah I’ve just setup the 1 upstream provider to be my dd-wrt router.

regarding the privacy issue, i’ve noticed that some clients request resolving local hostnames with .local anyway, so they seem to be sent often to the public upstream servers regardless of the privacy options. nothing too personally identifiable or sensitive though so i’m not majorly bothered.


Adding local=/home.lan/ or local=/local/ or both to /etc/dnsmasq.d/02-pihole.conf will prevent upstream lookups for domains ending with those.


I was poking around with this. Is there any negatives to adding my local servers to /etc/pihole/local.list? I know it works, but is there a down side to it?

Edit /etc/pihole/local.list through the web interface

Yes, local.list is erased and re-written on each run of pihole -g, i.e. at least once per week. To possibly update changed IP addresses.
See here for the code that does this.


a small update to my previous replies: i ended up switching entirely to pi-hole’s DHCP server over my router’s (DD-WRT set to DHCP forwarding mode to the pi-hole) and it’s SO much better. feels less hack-y and convoluted than the previous solution, and seems to be performing much better and more smoothly. it seems to be resolving hostnames and local addresses a lot better than dd-wrt’s own dnsmasq configuration. thanks for adding this as an option. it took me some apprehensive baby steps to make the jump but it’s a much more elegant solution to the overall package.


it worked very well, thanks
I set the DNS server in the router config and all are properly resolved.
I have only one problem, the web admin pihole is blocked, he stops himself :grin:
I tried to withelist the domain of my house but nothing.

Some screen:


What domain are you using to access the web interface? By default you can only use pi.hole, localhost, or the IP address.


Hi, thanks for your tips but i have tried everything from the inside of machine itself and from outside (ip, fqdn etc).
The same from inside of machine whit ip, localhost, etc:

EDIT: with “pi.hole” from inside of machine i did it! ty :slight_smile:

now i only have to understand how to have access from outside the pihole machine.


You have been mislead by the fact that the blocking page will also be shown for everything that would receive an error 404 (Not Found).

In your case, the resource you have been looking for does not exist. Note that you have to go to





yes, right. I can access to the admin page.

Many thanks and sorry for bothering you


No worries! We are glad if we can help :slight_smile:


I have gone through the setup and this is what I am getting:
pi@HornPi:~ $ nslookup

Default server:
;; Warning: Message parser reports malformed message packet.
;; Warning: Message parser reports malformed message packet.

** server can’t find hornpidns: NXDOMAIN


Non-authoritative answer:
Name: hornpi.Home

Default server:

Name: hornpidns.Home
Name: hornpidns.Home


Name: hornpi.Home

My question is why when I do a nslookup from the router ( for the pi-hole system hornpidns I get the “Warning: Message parsar reports mailformed message packet” but when I do it from the pi-hole ( it get the correct values?


Thats because you probably configured your upstream DNS resolving path like so:

[Clients] --> [Pi-Hole] --> [router DNS] --> [Upstream DNS could be your ISP] --> etc

The router doesnt have the DNS records your requesting and non of its upstream configured DNS servers (ISP etc) know the answer either.


The router has has the pi-hole for the DNS, the clients have the router for the DNS.


Difficult to explain as different routers do different things.
If a router serves both purposes of handing out IP details to clients via DHCP
and can resolve hostnames to IP addresses via DNS records,
they will create a new DNS record everytime a new client registers for a new IP address via DHCP.
Whenever a client asks a DHCP server for a new IP address (and other details like GW etc), the clients also advertise their own hostname so the router can create DNS records accordingly.
These are sometimes called “smart routers”.
But as your hornpidns IP address is probably setup statically, eg. the IP address was not acquired via DHCP from the router, no DNS records are/where created on the router.
Some routers allow you to create DNS records manually.
So you would need to create an DNS “A-record” pointing to the IP address of your hornpidns box.
And if your network is setup for IPv6, you would also need to create an “AAA-record”.


Or dont use a static IP address on Pi-Hole hornpidns and have the IP address fixed using the routers settings to fix an IP address for a particular device via the MAC address.
That way Pi-Hole hornpidns will ask your router via DHCP for an IP + DNS records will be created
and as you set a fixed MAC on the router, the same IP address will be assigned to Pi-Hole hornpidns persistently.


Or maybe putting an entry in the “/etc/hosts” file on the Pi-Hole box is sufficient eg: hornpidns