I’ve been wanting to build a Pi-Hole and install it on my home network for quite some time. It’s one of those projects that checks all of the boxes for me: it mixes hardware with software, includes a little bit of networking, and (best of all) it’s actually useful.
What is a Pi-Hole?
A Pi-Hole is a DNS server that runs on a Raspberry Pi and sinkholes any DNS traffic to domains that are on one of its blacklists(or manually added by the user). For example, when you type ‘www.google.com’ into your broswer, your computer makes a DNS request asking for google.com’s IP address. Normally, the Pi-Hole will return an IP address of 184.108.40.206 or similar. However, if google.com is blacklisted on the Pi-Hole, an IP address of 0.0.0.0 will be returned. This prevents the browser from reaching the intended destination.
Why is this useful?
Obviously, we wouldn’t want to arbitrarily block traffic to Google. Where the Pi-Hole really shines is in it’s ability to block traffic to known advertising, analytics, and malicious domains.
Often times, when you visit a website there is a lot more going on in the background than meets the eye. The website may load advertisements from various sources, it may send analytics data off to a third-party, it may even be compromised and attempting to serve up malicious content. This can lead to slower page load times, higher internet bandwidth usage, and possibly even compromise your machine. Blocking this traffic leads to a better, safer user-experience.
For this project, I’ll be using the following:
- Raspberry Pi 3 Model B+
- SanDisk 32 GB MicroSD Card(with adapter)
- Raspberry Pi PoE Hat
- HighPi Raspberry Pi Case
In addition to this, you’ll need a Cat6 Patch Cable and a switch that supports PoE.
Assembling the Pi-Hole
Assembling the Pi-Hole couldn’t be easier. The PoE hat plugs in to the Raspberry Pi’s header pins and attaches with the provided standoffs and screws. The Raspberry Pi itself snaps in to the HighPi case and the lid snaps shut.
I won’t cover the installation of the Raspbian operating system or the Pi-Hole software, but I will include some links to tutorials at the bottom of this post.
So, how well does it work?
My PoE Pi-Hole has been up and running 24/7 for over a month now with zero issues so far. What is most interesting is the amount of traffic it blocks on a regular basis – nearly 20% of all DNS queries! This has led to noticeably quicker page load times, especially on mobile devices.