Whether it’s a smartphone, tablet or PC, the all-rounder Raspberry Pi can easily block all online advertising at the router level, thanks to a small open-source programme called ‘pi-Hole‘. In this guide, we show you how to set up the Raspberry Pi to rid your network of unwanted adverts.
Suitable for: beginners with basic knowledge, advanced
Time required: about 1-2 hours
Budget: about £53
You need: 1x Raspberry Pi3 set, network cable optional
Can be extended with: NAS and VPN functions
You will also need: screen, PC keyboard, internet connection
Advantages over conventional adblocking solutions
Before we start with the “How To” guide, we would like to explain the benefits of a network-level adblocker over traditional adblockers in the browser. The biggest advantage is that adverts don‘t even reach your devices. This reduces the volume of data, your device consumes less resources, and the likelihood of malware infection from malicious advertising decreases.
Furthermore, pi-Hole offers a Call-to-Home VPN, which means that you can be free from adverts on all your mobile devices anytime, anywhere.
In addition, the web interface gives you access to insightful statistics on all network device requests and overall network performance. If you want to delve further into the topic, an API offers you the opportunity to develop your own scripting projects with pi-Hole.
Create a bootable microSD card
Depending on what other projects you have planned with the Raspberry Pi (RPi), you must first choose one of the following supported Linux distributions: Debian, Ubuntu, Fedora, CentOs, or Raspbian. If this is your first project, we recommend Raspbian, which is the officially supported operating system. You can find the image on the Raspberry Pi website under Downloads. There are two versions for download: Raspbian with and without desktop. If you are already an advanced user and have experience with Linux, you can do without a graphical user interface, which generally makes your setup leaner. For beginners, we recommend downloading the Raspbian image with desktop for the first installation. Then write the image to your MicroSD card with an Image Writer.
Boot and configure the Raspberry Pi
Now you can plug the MicroSD card into the RPi, connect all the necessary devices and boot the RPi for the first time. Depending on the distribution you choose, you will be asked for a username and password. For Raspbian this is ‘pi / raspberry‘. If it does not work on the first attempt, try ‘raspberrz‘ (QWERTZ vs. QWERTY keyboard layout) as the password.
Next, you need to connect to the internet. The easiest way to do this is to connect the RPi to your router via a network cable. To start the installation of pi-Hole, enter the following command in the console:
curl -SSL https://install.pi-hole.net | bash
This command downloads pi-Hole and launches a wizard that guides you through the installation. Since pi-Hole acts as a DNS server, it is important that it is always accessible to devices on the network at the same IP address. Therefore, during setup, you will be asked to assign a static IP address to the RPi. These can be managed in the settings of your router and assigned to devices.
You will also be asked to select an upstream DNS server. If you’re not sure which option is right for you, check the pi-Hole github repository’s wiki for all the information you need to make a decision.
We also recommend activating the Web Admin interface and logging when installing. When you complete the installation, remember to write down the password that gives you access to the web interface.
To verify that the installation was successful, enter ‘pihole status‘ in the console or go to the web interface.
Set up your devices
The most important step now is to configure the DNS server with your router. The exact implementation of this step varies depending on your router and your internet service provider. Read your router manual if in doubt.
Some internet providers prevent you from choosing your own DNS server. If this is the case with you, you have the option to specify the RPi as DNS server on your end devices. This is possible for any PC or smartphone operating systems.
You have now successfully set up pi-Hole and can check in the web interface which devices have been connected.
If there are any particular websites where you still want see the adverts, you can add individual pages to a whitelist in the web interface to remove adblocking. There is also a blacklist that not only blocks adverts, but access to the entire website. In addition to these two lists, the web interface offers a wide range of setting options to adapt pi-Hole to your needs.
Image credit: https://de.fotolia.com/id/138241378#