Many people use an ad blocker like uBlockOrigin to block ads from tracking us around the web but this only works on the devices it is installed on. We can do one better and prevent them all across any network in our control.
This method has the least overhead of the two and is great if you just want to get something up and running. Ideally, you would want a separate device to, but you can do this with any computer.
Every computer has a hosts file that holds data for converting domain names to their IP addresses. When you open one for the first time, it is pretty bare, and all requests get directed to your router for lookup.
Unified Hosts + Porn. Click the link to the "Raw Hosts File," and you will see an enormous list of domains.
That's it! Now you have a network level ad blocker!
If you want to have this file auto update every day to have the freshest hosts, just clone the repo, create a symbolic link, and then set up a Cron job to
git pull that repo once a day.
If you want a fancy interface to log into and see all the stats; check out Pi-Hole. I set this up as my project to test out Balena.io. They have a guide on how to set up a Pi-Hole with their site and your device.
One of the steps there is to set service variables, but this can not be done until Pi-Hole is installed on the device via the Balena-CLI.
Because of this, you won't have the password to log into the Pi-Hole admin page. To update this password navigate to your device on the Balena dashboard and run the terminal for the Pi-Hole service. Once in run
pihole -a -p pass where
pass is the password you want to use.
Once you have Pi-Hole running and can log in and add the Steven Black's Hosts Git Repo of your choice to the list of domains. Copy the URL to the raw file, then click settings in the Pi-Hole admin dashboard. Click the
blocklists tab, scroll down to the bottom, and paste the URL to the list you chose.
If you don't want to block anything other than ads and malicious sites than there is no need to add anything to the Pi-Hole.
After the Pi-Hole is set up all you need to do change your router's DNS server to that of the Pi-Hole, and you are all set!