It was time for a new project, one that would be realtively easy and cheap but still delivered some real end benefit. Taking stock of what I had laying around I picked up an unused Rasperry Pi off the desk and went looking for a mission - enter Pi-Hole.
Pi-Hole, essentially blocks all ad traffic to every device on your network that is using it as it's DNS server. Once you assign it as your DNS server for all devices on your network even those that cannot install ad block extensions will begin blocking ads.
Pi-Hole is software designed to be installed on a Raspberry Pi but you can install it on a linux box or inside a virtual machine as well. I went with the spare Pi I had laying around so what follows will reflect that choice.
Installing the OS
Head over to the Raspberry Pi website and download the Raspbian Stretch Lite image here. Once you have that image downloaded and unzipped you need to write it to an SD card to use in your Pi. (How you do this will depend on what OS you are using)
Hook the pi up to a monitor and keyboard for your initial configuration and login to the pi using the default pi login information:
login - pi
password - raspberry
Now you are going to want to change the default password and if you do not want to pull out that monitor and keyboard everytime you want to make a change then also enable SSH. to do this type:
Go ahead and click on the first option to change the password, then go ahead and drop down to option 5 - interfacing options - and choose SSH. Now you should see the command prompt at the bottom of the screen again and go ahead and run ifconfig and grab the IP address so you can login later.
Ok now back on your workstation go ahead and SSH into the Pi with the IP address you jotted down in the last step. Login in using the username pi and the password you created earlier. Go ahead and update and upgrade the packages installed:
sudo apt-get update && sudo apt-get upgrade
Once you have done all that go ahead and head over to the Pi-Hole website and grab the following command:
curl -sSL https://install.pi-hole.net | bash
You can use that scipt if you want but please don't trust me and go grab it from the Pi-Hole site yourself.
Once you run the script you will be taken through the installation process.
Go ahead and choose your upstream DNS provider. The hot new ones on the block are Quad9(which is a built in option) and Cloudfare's new 18.104.22.168, which you will have to manually configure as of right now.
Check if you want to support IPv4, IPv6 or both
Go ahead and choose if you want the admin interface - I think you probably do but that is up to you.
If you activated the admin interface then go ahead and enable logging otherwise the interface is pretty useless.
Go ahead and set a static IP for the Pi.
The software should have grabbed you default gateway but make sure it is correct.
And your installation should now be complete.
Make note of your password here You will need it to login later.
Head over to http://IP_of_Your_Pi-Hole/admin and you should end up here:
Here you will be able to view some great statistics like how many ads you have blocked, the percentage of traffic that has been blocked, who are the top advertisers, etc. You will also be able to add or remove addresses into the Pi-hole’s white and black lists.
Finally, you are going to want to make sure every device is using the Pi-hole as it’s DNS server. You can do this by either statically assigning every device in your network to use your Pi-hole’s IP address as it’s primary DNS server or heading over to your router configuration page and assigning it there.
Once all that is done you are good to go and enjoy an ad-less internet experience from any of your devices on the network.
Pi-Hole is a great open source project and if you have set it up and enjoy it why not head over to their site and throw them a little Donation so we can keep enjoying these open source projects so many people put forth the time and effort on. * I have no affiliation whatsoever with the pi-hole project or any member of the team.