How to Remove Intrusive Advertising with Pi-Hole and a Raspberry Pi

Advertising has nothing wrong if used responsibly and respectfully. Moreover, it is the way in which many projects are financed and that allows them to grow, improve and continue offering their products or services completely free of charge. Even so, when used intrusively, things change. For those cases, a simple Raspberry Pi plus Pi-Hole allows you to say goodbye to the annoying ads.

What is Pi-Hole?

pi-hole
Pi-Hole is an Open Source solution composed of different tools that allow you to control internet traffic . As if it were a firewall, it analyzes DNS requests and is able to block ads and crawlers for a list of domains that it obtains automatically or that you can add manually.

In this way, once you install it on the different compatible devices, you will not only eliminate ads that you can see in your computer’s browser (something you can also do through extensions that block these ads), also from other devices without the need for Install any add-on And that, for example, is very attractive to eliminate annoying advertising from iOS, Android or Smart TV devices. It can even be used to avoid ads for people over 18, such as bookmakers, pornography, etc.

Similarly, in the same way that you can eliminate advertising for certain domains, you can also add others to a white list to allow them to continue offering them and the operation of the page is not affected. That it is not right for them to pay just for sinners.

How to install Pi-Hole

Although it may seem complex, the truth is that the installation of Pi-Hole is not an impossible task for any type of user. Moreover, on the project page itself there are the instructions to follow to carry out the installation and you can check that there are methods for all levels.

That if, before starting, you need to have a device where you can install Pi-Hole. It can be a Linux machine or even a Synology NAS. Although in this case we will use the Raspberry Pi , because for a little money you can mount a global ad blocker for the rest of the devices connected to the network. So, with your board ready and with an operating system installed like Raspbian , we start.

As we said, there are three methods of installing Pi-Hole . On the one hand there is the fully automatic mode where you just have to start the system, open the terminal and execute this command:

curl -sSL https://install.pi-hole.net | bash

And on the other, two manual methods for those who seek to have greater control of the entire process. The first is this and clones the repository through these commands:

git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd "Pi-hole/automated install/"
sudo bash basic-install.sh  

And the second thing it does is download it and then execute it using the commands:

wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh

Choose the option you choose in a few minutes and you have everything ready to begin the process of setting up Pi-Hole . So, run the application and follow the steps indicated.

Once finished you will have access to the control panel, which is easy to understand and possibly reminds you of WordPress. At the beginning you will see the Dashboard or desktop with data of the blocked elements, requests, etc. and on the left, a column with the different options that allow you to see the black list of blocked sites or the white one with which you will allow them to send advertising.

How to configure devices to use Pi-Hole

With everything ready, the last step is to tell all your devices within the same local network that they should use Pi-Hole . This can be done in two ways :

  • Change the router’s DNS server with the IP address assigned to the Pi-Hole, so that all requests from any device pass through it.
  • Change the DNS server individually on devices where you want to take advantage of Pi-Hole.

Here it is you who decides what and how to use it. Both have their advantages and disadvantages, so it is a matter of valuing and testing. There is also the option to let Pi-Hole handle the assignment of IP addresses by DHCP, although unless you are clear how everything is going, it would not be the option we would recommend.