One of my readers recently mentioned he favorite thing to do with a Raspberry Pi was to set up Pi-hole. Having played around with Raspberry Pi for a while now I have heard of Pi-hole but had never used it. Well since I had a Raspberry Pi in my Home Automation Mix running a simple node.js to feed some audio into a Google Home from my SmartThings system I figured why not give it a try.
So lets start with what is Pi-hole? Simple, Pi-hole is a network-wide ad blocking system that runs on Linux hardware and requires no client-side software o and I should also mention Pi-hole is free to use but would recommended making a donation. With Pi-Hole setup over 100,000 ad-serving Domains are blocked automatically on any device connected to your network. This is accomplished by Pi-hole becoming your DNS server which can be configured in a few ways which is all covered on the Pi-hole site and is depended on your specific implementation so I will not go into that here.
Now that you know what Pi-hole is lets talk about how to install it which is actually pretty simple. First the prerequisites; you need a Raspberry Pi running the latest Rasbian connected to your network, because this is going to act as your DNS server when we are done I would recommend that the Raspberry Pi have a hardwired connection to your network through as few switches as possible. With that out of the way you will want to review the Pi-hole code located on the Pi-hole GitHub and run the simple one-step automated install:
curl -sSL https://install.pi-hole.net | bash
The installer will then run and ask you a few questions as it goes but that is pretty much it should take no more than a few minutes to have you up and running, well sort of.
As I mentioned earlier you will be configuring your network to use the Raspberry Pi running Pi-hole as its DNS server. There are a couple options to do this which are covered on the Pi-hole Discourse forum. You can Define Pi-hole’s IP address as the only DNS entry in the router, Advertise Pi-hole’s IP address via dnsmasq in the router (if supported) or Manually configure each device. Since I am lazy manual configuration was out right away for me and I began looking into dnsmasq which unfortunately is not supported by my eero Home WiFi System so that left me with one option and I defined the Pi-Hole‘s IP address as the only DNS entry. I have to say though when I went to click save on this change I was nervous what was going to happen with all of my connected devices but I clicked, it saved and my network rebooted with everything connected without missing a beat.
The app for my eero Home WiFi System system is nice enough to have speed test functionality built in so I was quickly able to see that I had not lost any speed with the switch to Pi-hole but I have never really trusted that so I ran a test myself and am pretty happy with the result:
Taking a quick look at the Pi-hole admin console you can easily see the blocking power of Pi-hole, after just a few days running over 5000 queries have been blocked!
Using IoTRant as an example you can clearly see the difference with Pi-hole on and off.
You can clearly see the omission of the ads in my side bar on the right hand side of the page. Now IoTRant does not have many ads in it so there is no great bump in speed but as we all know there are sites out there littered with hundreds of ads and on these sights you can see your page load times reduce drastically.
For me however the real power of Pi-hole comes in when you start looking at the admin console. The console is filled with so many analytics you can easy spend hours geeking out over all the graphs and charts…I know I have. But the admin console also gives you the power to Disable Pi-hole temporarily if needed, you can whitelist and/or blacklist domains configure all of the settings that you setup during initial installation and even debug your installation if you run into a problem. These are the tools that every developer should give to there users!
Overall I am very happy that a reader pointed Pi-hole out to me and very happy to have it up and running on a Raspberry Pi that was not doing much for me. Are any of you running Pi-hole? Let me know in the comments below and don’t forget to sign up for our email list to stay updated with everything doing on in the IoT space.
I am passionate about the IoT and connected devices. Using connectivity to automate our lives will empower civilization to achieve greatness.