Adblock, System-Wide, without Plugins… Pi-Hole!

This is absolutely awesome. I just came across Pi-Hole, a DNS based ad blocker that you can install on a Raspi or just some Linux box you may have around.

Basically, what you do is this: You log as root onto your Raspi or Linux box (I’ve tested it with Ubuntu 16.04 LTS; it did not work on an older 12.04), and just enter:

A much more detailed instruction, with lots of screen shots, is here.

Some packages are going to be installed, and later you just point your device’s DNS server to be the IP address of that Raspi or Linux box where you installed Pi-Hole. Since I have a router with OpenWRT, I have dnsmasq on it and hence have modified its dnsmasq.conf to have its server= statement point to the IP of the Pi-Hole box.

What then happens is that every DNS request will be routed through the Pi-Hole box, and if it is from a known advertiser, it will just be blocked. The net effect is, that all your devices will be mostly completely ad free. Since the only traffic going through that box is DNS requests, the solution is very fast, compared to web proxies.

Once installed, you can point your browser to this (local) URL to see a nice dashboard about Pi-Hole’s performance:

As you can see, the vast majority of my requests come from, which is my OpenWRT router that is now redirecting the DNS requests it gets – which means mostly all – through the Pi-Hole box.

For more technically inclined, here is the forum where Pi-Hole users discuss.

If you want to have Pi-Hole automatically update its blacklists, you can put this file as pihole-update into /etc/cron.daily:

Then make that file executable:

Here is a blog post of some other user who has posted some more details on the topic.

As a nice extra, if you have a Mac, and install BitBar on it, you can then add this plugin, and further more see nicely what Pi-Hole is doing for you:


The above menu is actually using a simple Python script to populate. I’ve updated that script so that you can now also directly enable / disable Pi-Hole. Here is what it does:

Here is the updated script (notice that I’ve changed, in line 20, the URL of the Pi-Hole to how it announces itself on the net independent of the IP address you gave to it; lines 35-37 are those that I have added to provide for enabling and disabling of the service):

And, as an uber-cool hack, should you use (unlike me) an actual raspi for this, here is how you can activate/deactivate Pi-Hole with an actual hardware button.


So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *