Shut Your Pi-hole: Ad Blocking with the Raspberry Pi

By | October 29, 2016

pi-hole displayAround 10 months ago, Pi-hole – an open source software that runs on Raspberry Pis and filters network traffic, made its debut and has been a popular topic in certain Raspberry Pi circles. The appeal of running Pi-Hole to block ads on your network can be explained succinctly: the software is easy to install, it blocks advertisements from over 100,000 ad serving domains which results in faster web page loading times as well as less data usage, and best of all, it works on all devices on your network without the need to download or install anything further. The software is lightweight and can even be run on the $5 credit card sized Raspberry Pi in most cases.

The installation took a few minutes to ensure all the dependencies were met. Once this was done, a click through menu appeared to confirm a few settings like network interface, IP addressing, preferred DNS (Google, OpenDNS, etc). Once this is done, the installer launches the service and gives you the Pi-Hole administrative address (your Raspberry Pi’s IP address + /admin). The only step remaining is to change the settings on your router (affects all devices on network) or change the DNS settings on the specific device(s) you want it to filter for. Here are the instructions for this part. Some ISPs don’t allow their customers to change DNS settings, so make sure to find out if your ISP falls into that category. Here are the three lines of code required to install Pi-hole (taken from the github):

wget -O
chmod +x
ssh'ing to pi with PuTTY

ssh to Pi w/ PuTTY and install. simplicity.

Enter the address into your browser and a tidy GUI appears. It will display some basic statistics about web traffic and how many ads were blocked. There is a query page which displays the domains requests have been made to. There are also pages for whitelisting and blacklisting, where you can manually add domains to allow or block – very handy.

pi-hole webgui

Between NoScript, uBlock Origin, and uMatrix I manage advertisements fairly well. However, Pi-hole still blocked several ads when I logged on to an ad ridden website. Also, the plugins that I mentioned require a bit of configuration and adapting to your browsing needs before they successfully block the bad domains and allow the ones you need. Therefore, Pi-hole is more of a plug-n-play answer to ad blocking that meets the needs of most users. If you would like another layer of protection, uMatrix or NoScript be a great compliment to Pi-hole. My first reaction was that Pi-hole’s blocking would come into play before the browser plugins. So I blacklisted a common advertising domain name and tried to load a page from their site and got “uMatrix has prevented the page from loading” – the plugins are indeed preventing the requests from even being sent out as well!


While it is easy to jump on the ad-hating bandwagon, it is important to acknowledge that many websites rely on advertising revenue to pay the server bills as well as other costs. Not all ads are good, but equally so, not all ads are bad. I like to look at it as a logical decision to ensure that my devices and networks remain secure – as ads are oftentimes an attack vector. Why are some ads unsafe? Some advertising networks have fewer rules and standards that advertisements must adhere to, resulting in unsafe and/or obtrusive ads. In contrast, Google’s AdSense network has a stricter set of standards that ads must conform to. This aims to create a more pleasant browsing experience for website visitors by reducing the frequency of inadvertent ad clicks, and has the added benefit of creating a safer browsing experience as well. So if you do end up using Pi-hole (the developer accepts donations), consider whitelisting certain domains, or adding exceptions to your Pi-hole.

One thought on “Shut Your Pi-hole: Ad Blocking with the Raspberry Pi

  1. Pingback: Adblocker and Privacy plugins for Firefox and Chrome –

Leave a Reply

Your email address will not be published.