Raspberry Pi Ad Blocker

With Raspberry Pi, you can block ads on websites by using a tool called Pi-Hole!


Pi-Hole is a very simple utility that uses dnsmasq and apache. Pi-hole automatically downloads and aggregates a list of known ad-serving domains. When a computer on your home network browses to a website, it performs a DNS query. This query translates a domain into an IP address. When DNS queries are sent to the Raspberry Pi, it is checked against a blacklist. If the domain is on the list, the Pi responds with it’s own IP address, which results in the client loading a blank webpage. If the domain is not in the blacklist, the Pi performs a DNS lookup against public DNS servers and provides a legitimate response.

If your Raspberry Pi is already setup, simply open a terminal window, and perform the following commands:

sudo -s

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

The install script for Pi-Hole will guide you through a few configuration steps.

Now, just configure your computer to point to the Pi for DNS! A convenient method of doing this is to set the DNS server to the Pi in your DHCP server’s pool settings. (Likely your home wireless router.)