Pi-hole

What is it?

Pi-hole is a network-wide ad blocker, called a “black hole for internet ads”. A pi-hole server essentially provides a DNS endpoint that devices can query when accessing the internet, and it serves as a filter on what domains are accessible. The server uses a number of blacklists to ensure queries to common ad endpoints are not resolved, thus preventing ads across many different platforms and devices. One can think of a pi-hole as a browser ad-blocker rooted at a lower level; instead of blocking connections made within your browser as sites are accessed, the pi-hole prevents ad requests from being resolved made from anywhere on the network (not just in a browser).

Setup

The only real setup is to ensure you can log into your router’s gateway interface, and have given the target device a static IP on the network.

Installation

Installing Pi-hole is very easy. Get your device (I’ve installed on a raspberry pi), navigate to the Pi-hole website, and copy the one-line install. At the time of writing, this was

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

This will then run an installation scripts on the device, querying some user input along with the way. Sticking with the defaults has been fine for me (although I chose Cloudlfare DNS over Google).

Once installation completes, you will be provided with the URL for the web admin, along with a password for login. That’s it for the install!

Setting Pi-Hole as DNS server

Once the install has completed, you still need to tell either

  1. The specific devices you want to block ads on to use Pi-hole as their DNS server
  2. The router to use the pi-hole as the DNS server for the entire network.

For official details about these options, see here

For the entire network

Navigate to your router’s web interface and look for DNS settings. Here you will have the option to specify the IP address of custom DNS servers. Make sure the only listed IP is the static IP of your pi-hole instance (if there are multiple options, fill them with 0.0.0.0 or simple repeat your pi-hole IP). Save the changes, and you’re done.

Note that one downside of this is it prevents device-specific registry. That is, to the pi-hole server, all requests may look like they’re coming from only one place (the router) since all device traffic is first routed there. This is really not a big issue unless you care to see what is blocked for specific devices. More on this here 2.

Sources