The Raspberry Pi can be used for pretty much anything, you can play your favourite classic games, or use it to stream more modern games from your computer. But in this article, we are going to turn it into an ad blocker for the entire network.
The main software that is making this all possible is Pi-Hole, what Pi-Hole does is turn the Raspberry Pi into a DNS server that can handle the DNS lookups from devices on your network. When it gets a query for something that is listed as an ad (for example) in its blocked domains list it will not let that query happen, therefore stopping an ad from appearing.
Getting the IP
It’s probably a good idea to get the IP address of your Raspberry Pi now and note it down as it will be useful to have for this tutorial. If you’re not planning on using SSH, then you can type
hostname -I into the terminal and that shall display the IP address.
If you’re running the Pi in headless mode, you can use Command Prompt and type in
ping raspberrypi.local and that will return the IP address of the Pi. Here, you can see the IP address of my Raspberry Pi is
Now it is time to install Pi-Hole, I am going to use SSH to connect to my Pi but you can use the terminal on the Pi itself if you want to.
There’s only one command that you need to input to download and install Pi-Hole, type
curl -sSL https://install.pi-hole.net | bash into the command line and press enter. The installer will now begin doing various checks to make sure everything is going to work correctly and it will also display the Pi-Hole logo in the terminal.
Once all the checks have been done, the Pi-Hole installer will download and install all of the necessary dependencies and packages needed for everything to work. Once everything has been downloaded and installed, you can now log in to the admin interface.
The web interface can either be reached at
http://ipaddress/admin. The latter worked for me initially after setup.
But that’s about it! Pi-Hole is set up and running and all you need to do now is point your computer or router DNS to the Raspberry Pi and then the ad blocking shall commence!
Ad Blocking can be a bit controversial at times, but ultimately it is your choice. Richard Tech is monetized by ads on both our YouTube channel and website.