gradient mesh cloud

Pi-hole: A Blackhole for Ads

I'm getting sick and tired of ads, and I want to fight back. (Ok, I've always been sick and tired of ads, and I've always been fighting back. But, whatever.) Addictive platforms that run on ads: Facebook, Reddit, Twitter don't want me to block their ads, and happily track me all over the internet. Those platforms and other platforms like iOS and Android not only track me, but will only give me enough control to block what doesn't hurt their bottom line.

So what can I do to fight back? It used to be that we only had 1 primary vector for seeing ads and navigating the internet: our desktop web browser. Install ad-block there, and you're done. That's not the case anymore. Phone, tablet(s), desktop, laptop, anything with a screen now shows ads. Each device has its own way of handling ads and gives different levels of control over installing ad blocking software. Some devices have web browsers that do not support ad blocking extensions. Most devices have apps that bypass ad blocking. We need some deterrence to all of the ads that pervade the devices we use on a daily basis.

One way to fight back is to go one layer deeper than the browser and to block ads on the network level by controlling DNS. What is DNS? Well, it's a massive, decentralized phone book that turns names like into ip address numbers like Computers communicate on the internet using ip addresses like we communicate by sending mail to home addresses. Every device capable of browsing the web uses DNS. Every time you try to go to a website, a request is first made to the DNS server to lookup the name and get the number that it corresponds to. If your DNS server doesn't know about a domain, it can't send you the IP address you need to get there. And if the DNS server intentionally blocks ad domains, it means those ad servers can't reach your device. Giving you ad blocking at a level of internet communication that is hard to bypass.

It sounds like a lot to do and maintain, but due to the power of open source software (along with donations), it's relatively easy! The project I use is called Pi Hole. It's called that because it's like a blackhole for ads, and runs on a Raspberry Pi. A small hardware device capable of running linux and enough power to act as a server on your network. This small device acts as your DNS server. Install the Pi Hole DNS server with ad blocking built in, and configure your devices to use Pi Hole as your DNS server. Voila, ads are blocked on your whole network. To a website or device trying to contact an ad server, it's like the server doesn't even exist. We've taken it off the visible internet.

Pi Hole has its own list of blocked domains. The software and block-list is maintained by open source contributors and relies on donations to survive. Be sure to donate if you use it.

In addition to a maintained block-list, Pi Hole also provides the ability to block whole websites. This is great for blocking access to websites that I don't want to spend too much time on. For me, this is Reddit and Twitter. Sometimes I find myself opening those apps or websites and scrolling mindlessly as a distraction. Sure, sometimes it's fun, but just like not buying boxes of cookies when you're on a diet, I don't want to have those distractions immediately available at all time. I should have to make a conscious choice to unblock them so I can decide if I really want to use them and not fall into the dreaded technology loop.

Ok, great, so that's what I started with. I loved that websites loaded faster, I didn't have to think about ad blocking. There was no discernible slowdown in performance despite all of my DNS requests being funneled through a low power Raspberry Pi. I even got ad blocking in apps that the iOS browser ad blocking doesn't block. Two problems still existed though. First, sometimes I need to disable ad blocking for a short time to use a website that's on the blacklist, an important /r/rarepupper meme. Second, this only works on my own network, not on my cell traffic.

I needed the ability to disable ad blocking temporarily, and I didn't want to have to remember to turn it back on. Pi hole provides an administrative web interface that can temporarily disable ad blocking. So I figured it might be possible to do this in an easy to use app too. It is, and thus Pi Hole Remote was born. It's a dead simple app I made that lets me temporarily disable ad blocking so that I can conveniently use the internet and still have ad blocking when I need it.

In order to use Pi Hole outside my network, I had to set up a VPN. Mobile phones have the capability to configure DNS for a wifi connection, but not for your cellular connection. If you funnel all of your traffic through your own VPN server, you can configure the primary DNS server as your own Pi Hole server, thereby blocking ads for any VPN clients. I also get the added benefit of securing my connection to the internet a little further by encrypting all of my traffic between my phone and the VPN server. Useful on unsecured wifi networks. I followed a few tutorials for setting this up.

So far, I've been really happy with this setup. I may try different VPN software like Algo to see how it compares to OpenVPN. I would like to publish Pi Hole Remote to app stores when it's finished and support it if people need additional features.

The internet is great. All of the world's information at our fingertips. Useful information like scientific facts, recipes, and global journalism, but the internet also distracts us with a constant bombardment of ads and other people's thoughts on social media. This is one small way to fight back. It's been said that "a wealth of information creates a poverty of attention." Our attention has become a scarce, precious resource. We need to do whatever we can to protect it.