Raspberry Pi / PiHole

let me begin by saying this.

I despite advertising.

I understand the need for it, sure. But we as a society have elevated it to the point where the content we want is secondary, and the advertising is primary. Go to almost any website, and find yourself bombarded with ads. Turn on the tv, and discover that you get five minutes of programming and then ten minutes of ads. Listen to cable news on satellite radio, and realize you get more ads than you do news. Even my mother recently commented that her morning current events show, Good Morning America, was now more like the home shopping network, as they spent a significant amount of time trying to sell her something, in between the commercials.

Years ago, I grew tired of the unending marketing. I developed a desire to not be the recipient of it all, and made it a point to take myself out of the equation. The wife and I disconnected the cable tv. We subscribed only to streaming services that were ad free, or had an ad free tier. When they changed to ads, even though we were paying, we cancelled our service. We even went so far as to install numerous ad blockers on phones, tablets, and computers, knowing it would hamper our experience, and require regular maintenance and upkeep.

Fast forward several years later, and I’ve grown tired of the ad blockers. they sometimes work, sometimes dont, block things you dont want blocked, miss things you do want blocked, and they themselves charge a fee, and sometimes come with advertising. I was slowly becoming desperate for a solution. And that is when a friend said the word “PiHole.”

I began researching this open source piece of software that claimed to be the solution for all my woes. It was free, lightweight, easy to use, and customizable. This looked to be a solution. All I needed was a Raspberry Pi to install it on. With my mind made up to try this next solution, I bought a Pi, and began digging for a tutorial that would guide me to the promised land. As it turns out, I found this tutorial from CrossTalk Solutions:

The World’s Greatest Pi-hole (and Unbound) Tutorial 2023

Realizing that this was about to be way easier than I had planned, I unpacked my newly delivered Pi, plugged it into its case, hooked it up to ethernet, and pulled its IP address from my Unifi console. I SSH’d in, and followed the setup instructions. I then configured and customized the pi to my liking. Once done, I changed my network’s primary DNS to the static IP I’d given the PiHole. I tested, and ads had begun to vanish. I tested my setup with this website:

https://d3ward.github.io/toolz/adblock

Anything it said had gotten through, got blacklisted. Upon re-testing, I was up to 97% blocked! I then pulled the ad blocking software off all my devices, and re-tested. Still good! I was feeling victorious, and like I was one step ahead of the advertising juggernaut once again.

And then I left my house. The first hint of a hitch in my plan happened at dinner one evening. My wife and I connected our phones to the restaurant wifi so we could see the news while waiting for dinner. Much to my dismay, ads everywhere. It was Just as bad as before. The PiHole only worked at home, as it managed my home network. Now, I needed a solution for when I wasn’t home. I wasn’t disheartened, I was determined.

Chasing my nerd street cred with arms outstreched, I logged into my account at DigitalOcean. I spun up a super cheap droplet, and installed ubuntu on it. I gave it a static IP address, and logged into its command line. I installed PiHole and set it up like I had previously. Then, I logged into the admin page, finished my setup as before, and made a note of its IP address. The next night, when The Missus and I were out to dinner, I connected to the restaurant wifi. This time, however, I went into my settings, and changed my DNS server to the IP address of my PiHole Droplet. A quick refresh, and looky there, no ads! I had an on the go solution! Of course, it meant changing my DNS server every time I connected to a wifi network, but it would work almost anywhere. Granted, I couldnt change the dns servers of my cell service, but, the majority of that use was CarPlay anyway. I was close to victory!

And then a coworker asked me a question:

What if your Pi dies? Whats your failover solution?

Good gravy, he was right! When I got home, I promptly added google DNS to my secondary and tertiary line items in my Unifi console. Whew. Okay, solved. Or so I thought…

That evening, the ads began creeping back in. A quick double check, and I confirmed that my DNS wasnt failover, it was round-robin. if I used Google DNS, it would send queries to it, and the ads would come back. I couldnt let this happen! I ordered another Pi, and cloned my original. I now had two Pi’s running on my network, one for primary DNS, one for secondary DNS. Then, being a Smart Monkey™, I put my cloud based Pi in as tertiary DNS, just in case.

I now had a triple redundant ad blocking solution at home. I cloned my cloud Pi, and setup a second one. I now had two cloud pi’s in case there was an outage, and I was out and about needing ad blocking. Victory felt very close at hand.

As of now, I have 4 PiHole instances. Two are hardware, two are virtual machines. My home is now ad free. When I’m out and about, I have two IP addresses to use as DNS, to block ads on any network I join. Overall, I’ve spent about $160 on Raspberry Pi’s. My virtual machines cost about $5 a month. Considering we were paying a decent penny for ad blocking software on all of our devices every month, I ought to break even this year. And, updating is easy. Once a month, I log into each Pi, run a couple scripts at command line, and things update without issue. The internet is now much quieter, allowing me to focus on the business at hand, rather than the incessant reminders to “buy the thing.”