Nobody likes all those intrusive ads everywhere. There are lots of really good ad blocking extensions for your favorite browser, but what about all those annoying ads when you’re playing games on your phone? Can you stop those? Well, I have some great news for you. You absolutely can! It’s relatively easy to put a network level add blocker on your home network and block them at the network layer, before they even get to your device. Want an added benefit? You can also stop a lot of malware and virus delivery too. All you need is a Raspberry Pi or Linux system and to know how to configure your DNS Server settings in your home router.
So, how is this all possible? First, we need to talk about how the internet works. In this post, we are going to focus on DNS (Wikipedia) and IP Addresses. An IP address is to the internet as a street address is to your house. It is the unique place where website lives. DNS is the system that converts (aka, resolves) the friendly URL (aka, domain) that you type (for example, cnn.com) into an IP Address. So, without DNS, your computer won’t know where to go to fetch the website you want. Just about everything on the internet relies on DNS, including ads and lots of viruses and malware.
Pi-Hole (link) is a software that acts as your DNS resolver. What makes Pi-Hole awesome is that it allows you to add lists of URLs it should not resolve. So if you go to CNN at cnn.com, part of that website will include links to other URLs to serve their ads. It could be something like ads.cnn.com or adservice.somethirdparty.com. Even worse, those ad systems can track you between different websites! This is why when you go to Home Depot’s website and search for lawn mowers, you start seeing lawn mower ads on Facebook. Pi-Hole stops your device (computer, smart phone, tablet, whatever) from being able to resolve these known ad domains.
What next? Install and deploy.
Rather than reinvent the wheel and write up my own guide to setup Pi-hole, I felt it better to point you in the direction of some other folks who have already done a stellar job at writing up walkthroughs.
- How to Set Up Pi-Hole on a Raspberry Pi Zero – Yash Wate
- How to Set Up Pi-Hole – Christoph Schmidl
- Privacy International’s Guide to Pi-Hole
- Pi-Hole on Ubuntu – LinuxIncluded
- Install and Use Pi-Hole on Ubuntu – ComputingForGeeks
So once you have Pi-Hole running, you’re going to want to add some blocklists. Pi-Hole comes with one blocklist out of box, which is pretty well maintained. But, you can tune further. Check out this article for more information on adding blocklists and this one for a very robust set of lists.