I hate advertisements. Hate them.
It’s no secret that I dislike ads. I don’t mind them in principle, they are just really, really really annoying. In the modern world, our lives have become a constalt battle against the torrent of advertisements flooding nearly every part of our life, digital or otherwise. In fact, the amount of advertisements is one of the key reasons why I cancelled my cable connection and cut the cord.
Advertisements are a problem of pandemic proportions, and it’s only ever going to get worse. In the Chinese web, most sites feature more advertisements than content. I maintain my viewpoint that good content will always find supporters and will not have to rely on advertisements to sustain content creation. The rest of the time, ads are just annoying, and I do my absolute best to find a way around them.
The first thing I always do when I have to work on a new computer is to install Ublock. Ubock is an open-source, cross-platform content-filtering extension that I rely on to remove the worst of the advertisers. Thanks to the continued work of voluenteers, most ads can be excised from the page, saving you precious bandwidth and time. Unfortunately, this only works on browsers that have extension support. What if you wanted to block ads on your mobile device? Enter Pi-hole.
The Glory of Pi-Hole
Pi-hole, the self-described “black hole for internet advertisements” is a network-level advertisement and tracker blocking application running on linux. By acting as a private DNS, Pi-hole tackles the problem of advertisements from one of the oldest aspects of the internet, the Domain Name System.
In the broadest of strokes, the internet operates as a large collection of machines with addresses pointing to each other. The addresses are numeric (IPv4) or alphanumeric (IPv6) and are easy to work with for machines, but hard to remember for humans. It’s much easier to remember, say, google.com rather than 184.108.40.206. The DNS resolves lettered names into IP Addresses.
Pi-Hole acts as a private DNS that delibrately fails to resolve advertisements and tracking domains. This means that content from these URLs will not load on devices that request them. Obviously, this is a much better solution than ad-blocking at the extension level.
Setting up Pi-Hole
Setting up a Pi-Hole could not be any simpler:
- Get a Raspberry Pi. You’ll also need a SDHC Memory Card, I recommed one with quick write speeds so you aren’t waiting around forever, like this Sandisk 32GB card. Don’t forget your cables and charger.
- Download your favourite linux distro. I use the latest version of Raspbian.
- Mount the distro onto the memory card, then pop the memory card into the Pi.
- Plug in the RPi into your router. Don’t connect via Wifi as it will introduce a lot of latency in the DNS calls. Use a Ethernet cable to plug it into your router instead.
- Find the RPi on your network and SSH into it:
ssh pi@<your RPi IP>
curl -sSL https://install.pi-hole.net | bashand follow prompts. I chose to use CloudFlare’s 220.127.116.11 as the DNS upstream provider, mainly because it’s faster. You can choose any of the providers listed.
- Configure your router to use your RPi as DNS.
- Enjoy a life free of most advertisements.