Finally a way to enjoy the internet at home across all devices without the overwhelming onslaught of Ads! When I say all devices, I mean ALL devices; Apple 4k TV, SMART TV, Andriod, iPhone, iPad, laptops, desktops, servers, and virtual machines. Let’s eat!
Disclaimer here, I already have a pretty beefy server setup that acts as my personal media server and on top of that it encodes video for me for YouTube. It also, on occasion, will host Minecraft, Space Engineers, or other game servers. If you don’t already have a server, you can still do what I did but probably with an old pc you have laying around. If you don’t have one, you could always buy a used or new computer. It does not need a lot of horse power to be an Ad Blocking server. Why? Well the software we are going to be using was originally created to run on a Raspberry Pi. So hell, you can just buy a RaspBerry Pi if you wanted.
Now, for my home server it runs Unraid as the host operating system. Within Unraid we can install a wonderful application (containter) called Pi-Hole. Pi-Hole is what enables us to block ads on our home network. Pi-Hole is free and as far as I know can run on Windows and Linux. So if you aren’t up to the challenge of buying Unraid, you have some alternative options. Okay, let’s break down what I have available to make this happen.
I think it is fairly common for most homes to have a modem/router/wifi combo box at home. With a smaller group having a separate Modem and router/wifi. In my case, I have separate everything. My modem, router, and wifi access point, are all their own standalone devices. If that isn’t your case, don’t worry. You can still do something similar so long as you can access the router and edit the DNS (domain name server) IP Address.
We are going to start with the server because well, in my opinion, it’s going to be the crutch here, without it there is no Pi-Hole or ability to block ads. Well there are other ways to block ads but for arguments sake, this is the easiest for me because I have pre-existing hardware. Three years ago if you would have told me my Media Server would have been expanding into the blocking ads territory, I would have laughed it off, only because I would have thought it would be a crazy hard process to implement.
Anyway…… This is going to cater more to someone who already has available equipment and Unraid. “Transcencia” my Unraid do everything server is on 24/7/365. Seemingly everyday that goes by I find more and more capabilities to implement on her. Thankfully, the server has plenty of hardware to handle anything I throw at it. It has 16 cores and 32 threads between the Dual LGA 2011 E5-2690s and has been upgraded with Samsung 8GB RAM modules which gives us a new grand total of 192GB’s of RAM. It has become one fantastic piece of hardware over time. Now again, YOU may not need something this powerful if your only objective is to block ads on your network. For me though, I love going the absolutely overkill route first, then filling in the gaps with new capabilities later. Which is literally what I have been doing over the last couple years.
Once again the amazing, the wonderful, the versatile, and stupendous Unraid roars it’s mighty head. I keep going back to this OS for everything and you might be thinking, “Well yeah duh, all you go on about is your server that does everything.” This of course wasn’t always the case. I USED to be of the mindset 1 server, 1 job. However, ever since discovering Unraid, I have never wanted more in life than to push this OS to brink of it’s capabilities. Which, by the way, Unraid has only ever crashed on me a couple times because I over taxed it. Also, to note. I have two Dell R330’s basically collecting dust now mostly because Unraid has facilitated all of my growing desires. Also also, I used to have a second server with Dual LGA 2011 2670’s (named “Advent”) but after quickly starting to realize the true depth of Unraid, I started to notice how much I really didn’t need another badass server wasting power.
Having Unraid as our OS, we can very easily install Pi-Hole as container within Docker. Using Pi-Hole as a container reduces hardware and software overhead because it has direct access to all of the hardware resources it may need. Pi-Hole takes almost no resources by the way. I think I saw a 2% RAM utilization increase but it may be closer to 1% because I’m potentially misremembering.
Finally, what is Pi-Hole anyway??? Well, direct quote from Wikipedia, Pi-Hole is…
… a Linux network-level advertisement and internet tracker blocking application which acts as a DNS sinkhole (And optionally a DHCP server), intended for use on a private network. It is designed for use on embedded devices with network capability, such as the Raspberry Pi, but can be used on other machines running Linux and cloud implementations.
In other words, Pi-Hole looks at DNS records to block tracking and advertising domains/websites. Now, the way I have it configured is to act as a DNS ONLY. I am not using it’s DHCP server functionality. Why? Because my router already performs the DHCP role and that was one thing less I wanted to configure.
What makes Pi-Hole great is that it will block advertisements and telemetry BEFORE any of your devices access a website and it’s contents. Typically people use Ad-Block Plus or uOrigin to block ads in their browser. What makes Pi-Hole superior to normal ad blockers is the fact that ALL devices on the network will no longer be as susceptible to displaying advertisements. This is the key difference.
Now for the record, Pi-Hole does a great job of blocking ads but it doesn’t always block all ads. This is actually a good thing, why? Well some websites we visit may truly need that ad revenue to stay afloat to keep making content. By default without going to crazy on your blocklists, I say it is more than good enough. However, if you find that you still need more blockage, you can download more blocklists or specifically block domains through the webUI. Blocking items through the webUI is amazing. That way those sneaky few ads that do pop up can be blocked on demand or at a later time. Just be careful here, you can totally kill a website, or in my case totally lose access to YouTube from my Apple 4K TV. If you block too much you can whitelist domains, this way you can kind of back track on a mistake.
Very cool right! Well if you think that’s cool wait till I tell you that you can block all ads on your cellular devices using your Pi-Hole container. Mwuaha mwuahahaha mwuahahahahahahahahaah! I can feel the excitement growing in your veins. More on this point later : D bonus content!
Enough Overview Tell Me HOW!
Well, I won’t tell you but my friend Ed aka SpaceInvader_One has put together a great tutorial on how to get it all setup and will tell you all about it. I highly highly recommend watching this video first!
If you follow this video everything should work fine. Here are a few things I did differently.
The first difference is I wanted to set a custom IP address so I could make a DHCP Reservation for Pi-Hole. In order to do this, I needed to change the Network Type to “Custom: br0” and assign the IP address it would be given from the DHCP Server.
The next thing I did differently was assign the first DNS to be my Ubiquiti Router. For whatever reason, the entire network would fail if Pi-Hole wasn’t using my UniFi USG as a DNS. Also, to get UniFi to work with my Pi-Hole, I needed to change the DNS to from the USG itself to the Pi-Hole container. Weird stuff. I believe this will only apply to the Ubiquiti UniFi USG only.
Finally, one of the last changes I made was to the Time Zone, password, and Interface. I have no idea how the time zone should normally be formatted for other time zones but this works for me because when I check the logs, the time in the logs matches my system time. I needed to set the interface to br0 because that is the name of my bridge within unRAID.
So you got Unraid installed and Pi-Hole setup as your DNS…
But you are still seeing ads
Try disconnecting all devices from wifi (Forget This Network) and reconnect them. More than likely your devices are still using the original DNS IP Address
But now I can’t get to any website
Try configuring the DNS setting in your router to look at Pi-Hole and make sure Pi-Hole is pointed to your router.
This seems to be the case for Ubiquiti hardware
I’m still seeing ads on my devices even though all my devices have the correct DNS setting for Pi-Hole
Time to get more strict and add more domains/websites to the blocklist: https://wally3k.github.io/
Be careful adding to many at once, some of these will straight up block access to sites like Reddit
Also some of the items you can add to the blocklist will block you from using Google link results so again, be careful when black listing domains
Block Ads on Mobile Devices
Okay, bonus content time. So you want to be able to block ads on your cellular device. Well you are in luck. Because if you are using Unraid and already have Pi-Hole configured, you can now setup OpenVPN in Unraid and connect to your home internet through the VPN. When you are connected to your home network, guess what, your DNS will be your Pi-Hole server so now when you watch YouTube on mobile you can say bye bye to all of the ads.
Why Would I Want This
Well, MANY MANY people have to pay for data on there mobile plan and guess what, every time that video ad plays or every time an ad loads guess who is paying for it, YOU ARE! Not only are you paying your cell provider money for your data but you are ensuring that Pandora, YouTube, Forbes, whoever it may be, is collecting ad revenue from you. Now normally I’m okay with ads at home (as long as they aren’t shoved in my face and more than 10 seconds long) but when you start using up my precious data limit and costing me small amounts of money, that’s when you have gone too far.
In my opinion, ads playing on mobile devices is robbery. You are paying Verizon, AT&T, whoever it may be some serious money to use mobile internet. You are not paying them to ensure they deliver content you do not consent to see nor do you even want to see. So each of those ads is double payment to the big guys.
Secondly, you may want this just for a better overall mobile browsing experience. No annoying ads every 10 seconds when listening to iHeartRadio or w/e the kids are into these days. Imaging listening to your YouTube playlist virtually undisturbed. How blissful.
Of course if you wanted to avoid ads all together you could just pony up the money for each service you use and stop free-loading. That will only last just long enough until pay tiers become a thing.
“Oh Tier 3 service has ads just not very often. If you upgrade to Tier 1, you won’t have any ads at all." - Corporate Commander
Now connecting to your home VPN just to block ads isn’t the most ideal setup. If you already have bad service like I do then you will see some added lag/slowness/latency to your connection. See below as an example.
Now don’t get me wrong. Ads aren’t inherently bad, the real problem is that the vast majority of websites poorly implement them. They are too intrusive and create too much clutter. I’m all for having web ads but they must be done right for the love of all things that are holy.
How to do this
Assuming you already have your OpenVPN setup, all you need to make sure “Clients use a specific DNS” set to true and that you specify PiHole as the DNS. My PiHole DNS IP Address is 10.10.10.7. See below.
If you have a backup DNS or secondary choice, of course enter it into the Secondary DNS spot.
Anyway, I think that is about all folks. If you have questions drop a comment or email me. We will figure it out.