Pi-Hole: DNS server as ad blocker for the entire home network

Pi-Hole is a DNS server that has a built-in ad blocker. The advantage of this solution compared to an ad-blocker plug-in in the browser is that Pi-Hole can be used as a DNS server for any device in the network, including mobile phones, consoles, TVs, etc. - for the entire home network.

Short excursion: How does a DNS server work?

Whenever we visit a website, we need a DNS server. If we want to call up google.de in the browser, for example, the browser will first ask a DNS server for the IP address behind "google.de" before it can start surfing. The DNS server acts as a "telephone book" and tells the browser the corresponding IP address, which is then called up.

What does this have to do with ad blockers?

Pi-Hole has a white list and a black list. The lists are maintained automatically, but can also be adjusted. If the browser tries to call up a domain of a known advertising network, Pi-Hole recognises this on the basis of the entries in the blacklist and does not return the correct IP but its own. Result: The advertisement is not loaded, instead a message is displayed.

Installation

Pi-Hole is quite easy to install:

curl -sSL https://install.pi-hole.net | bash

The installation is self-explanatory and completed after a few steps. Important: At the end of the installation, the password for the admin area is displayed; we write this down.

Once the installation is complete, Pi Hole should be ready for use. To use the new DNS server, it must be entered in the clients. This can be done either manually or via a DHCP server.

Problems

I still had two challenges to solve:

  1. I already use a DNS server that runs on the Raspberry Pi. I did not want to switch off this server, so I installed Pi-Hole as another DNS. After the installation, the port of DNSMSQ (this service is used by the Pi-Hole as DNS server) must be changed. This can be done in the file /etc/dnsmaq.conf. Then restart the service.
  2. Since I already use a DNS server, I have entered Pi-Hole there as Forwarded DNS.
  3. Pi Hole installs lighttpd as the web server, which is bound to port 80. This port was already assigned to me. To change the port, simply edit the following file: /etc/lighttpd/conf-available.

1 comment

  1. Hello, I came across your page while searching for my problem with BIND9 and the Pi-Hole. If I understood correctly, you have Bind and Pi-Hole running on the same Raspi. I managed to get both to run in parallel. But now in the Pi-Hole Admin Console only the localhost is shown which generates almost all queries. However, I would like to see which clients are making the queries. Can you tell me how exactly you solved this with the configuration? That would be really nice 😉

Leave a comment

E-mail address will not be published.


*