Privacy

Setup Pi-hole: Use Your Own Ad-Blocker

Erik Bärwaldt
Author
17. Jan 2023
Last update

Online ads aren't just annoying for regular users, they're also a nuisance for IT admins. Installing ad-blockers on multiple computers and/or browsers takes a considerable amount of time and effort. Simply blocking ads and trackers with a DNS server, such as Pi-hole, is much easier.

A free piece of software, Pi-hole makes it possible to centralize ad-blocking efforts on small computer Intranets, without requiring configuration on each connected device. Once Pi-hole is installed, it'll block ads on every network device, even Smart TVs or gaming consoles. For that reason, the solution is ideal for home and work networks.

In this article, we'll let you know what you need and how to set up Pi-hole.

Requirements: What You'll Need for Pi-hole

Pi-hole is a piece of software based on the open operating system, Linux. Although specifically developed for use on microcomputers, Linux can also be employed on devices like NAS systems or in combination with a router. Regular Intel systems and docker containers are also supported.

The easiest and most quickly configurable solution would be to install Pi-hole on a Raspberry Pi single-board computer. Below, we'll let you know how to do this.

Set Up Pi-hole: How To

Only a few steps are needed to configure Pi-hole on a Raspberry Pi:

1.

Prepare Your Raspberry Pi

Start by installing a current version of Raspberry Pi OS on your Raspberry Pi. Make sure that you use a fast enough memory card in order to reduce system latency later on. In addition, the single-board computer should be connected via cable to your Intranet.

Find the Right Raspberry Pi Operating System

All Raspberry Pi OS variants are ideal for running Pi-hole: Should you want a graphic desktop environment on your single-board computer, you can install Raspberry Pi OS with desktop (840 MB). On the other hand, if you're comfortable with command prompt, Raspberry Pi OS Lite (300 MB) helps to save space. Both are compatible with any generation of single-board computers since they support 32-bit hardware.

For the latest Raspberry Pi computers (third and fourth generation), you can use a 64-bit version of the operating system. All of these variants are based on Debian 11 (bullseye).

Immediately after installation, execute the command apt-get update && apt-get upgrade in order to update the operating system. Should this have already happened during the automatic setup process for Raspberry Pi OS, you can skip this step.

2.

Install Pi-hole

In the next step, you'll install Pi-hole. To do this, open Terminal with administrator rights and execute the command curl -sSL https://install.pi-hole.net | bash

This won't only install the Pi-hole software on your Raspberry Pi, but also automatically start the setup wizard in Terminal. With this, you'll be able to completely configure your system in just a few steps.

3.

Configure Pi-hole

After a few instructions, the setup wizard will ask about the network interface your system uses to connect to your Intranet. The wizard will list all of the physically available interfaces, allowing you to freely select which you want to use for your ad blocker.

It makes little difference whether you're setting up a cable-based or WLAN interface. Using a WLAN interface is recommended only for smaller Intranets owing to its greater speed and stability.

Set up Pi-hole.

Finally, select from the list of public DNS providers the client that you want Pi-hole to forward Intranet requests to.

Configuring Pi-hole further.

After this, you'll set up the actual ad filter. This software identifies ads based on pre-made lists which are constantly being updated. When first configuring your ad filter, a list will be activated in the appropriate dialogue.

In the next step, you'll assign your Pi-hole system a static IP address, which all of the clients on your Intranet will later use to connect to the Internet. Alternatively, you could assign the static IP address via your router by modifying the DHCP configuration. If interested in this option, consult your router's user manual for further information.

The next dialogue box requires you to specify whether Pi-hole should install a web server and accompanying web interface for the administrator. By default, the lightweight Lighttpd web server is integrated with the required PHP modules in the system. In the final dialogue box, you can adjust settings relating to log files. After that, the system will be automatically configured based on your preferences. Since some large files need to be downloaded, this process can take some time.

Don't forget to note your password.

Once setup is complete, you'll return to the Ncurses dialogue and be able to adjust the IP address and web interface settings. Here, you'll also be shown the web interface's password, which is necessary to log in to the graphic settings dialogue. Jot this down somewhere!

4.

Graphic Configuration

You can make adjustments to your Pi-hole system anytime. For example, you might want to support a high-quality website that you frequently visit by whitelisting it and allowing its ads to display.

To change your system's configuration, input your Pi-hole system's IP address in a Web browser of your choice, followed by /admin (i.e. 192.168.1.1/admin). Alternatively, you can go to http://pi-hole/admin.

In the dashboard that opens, you'll be able to view a number of useful statistics. Click on Login and input your password. After that, you'll be able to adjust your system's settings.

The dashboard includes useful statistics and offers a way to add exceptions for websites whose ads you want to display.

Blacklists and Whitelists

Blacklists and whitelists make it possible to prevent certain domains from displaying ads, or, alternatively, allow them to. Subdomains can also be specified on these. The accompanying settings dialogue can be found in the graphic interface under the similarly named group entries to the left of the vertical option bar.

Additional Lists

Additional filter lists can be activated via the Group Management category by clicking on Adlists and then loading the list in the area off to the right. A range of different filter lists can be found online, for example, at https://firebog.net .

You can activate additional filters and make adjustments in the dashboard.

5.

Change Your DNS Server

In order for your Pi-hole computer to be able to act as a DNS server for all clients on your Intranet, it will either need to be marked as such on your router or, you'll have to change each client's network settings. 

Supposing that you decide on the second method: On Windows, the adapter settings interface is responsible for this, whereas, on Linux, the DNS server's connection settings will need to be updated to reflect the IP address of your Pi-hole system.

Since this process needs to be performed on every computer intending to connect to or be used on the Intranet, it's very time intensive and we advise going with the first method. With this, you'll only need to make changes to your router's settings. Because the accompanying steps vary depending on the type of router you have, please consult your router's manual for further information.

Pi-hole Alternatives

There are a number of different ways to block annoying ads that appear while surfing. Some of these are based on different concepts, while others offer additional features which might be appealing to you.

Browser Adblockers

These days, nearly every browser seems to either come with a built-in adblocker or make it very easy to install one as an add-on. While browser-based adblockers generally bring only adequate results, the add-ons are more than capable of fending off ads and trackers as efficiently as Pi-hole, with similar configuration options and settings. 

The biggest disadvantage of these is that they need to be installed and configured on every individual computer or device that they are to be used. Should a computer have multiple browsers, an adblocker will need to be installed in each. For these reasons, browser-based adblockers are only really suited for small Intranets or individual systems. Be sure to check out our EXPERTE.com Top 5 Ad Blockers.

Browser-based adblockers can also be combined with anti-tracking plugins, which make it difficult, or even impossible to follow a user's surfing behavior. If you're interested in learning more about these, be sure to check out our anti-tracking guide.

DNS Server With Adblock Capabilities

For large-scale, corporate IT infrastructure, DNS servers with adblocking capabilities serve as a nifty alternative to a Pi-hole. These operate on the same principle, however, can be installed on regular computer systems or single-board computers, like Raspberry Pis. 

To some extent, virtual computers or container solutions can also be used for this purpose. Some providers offer pre-configured solutions, which only need to be connected to the Intranet, and don't require manual configuration. Among these are eBlocker OS, Technitium DNS-Server, and the Austrian Upribox.

All of these systems are Linux-based and can be set up on a Raspberry Pi, meaning that they can stay on around the clock without consuming large amounts of electricity (and driving up costs). In addition, all standard DNS servers with adblocking capabilities offer graphic interfaces (dashboards) which make it possible to use them easily and ergonomically.

Conclusion

Pi-hole offers a quick and useful DNS server for blocking ads. Thanks to its integrated, web-based dashboard, it can be efficiently configured to your exact preferences. One of the nicest features of this option is that the accompanying software can be readily installed on older Raspberry Pi single-board computers without creating any noticeable latency. Users lacking technical knowledge about networks might find them appealing since they run on their own and require little administration or maintenance, making them a solid choice.

Author: Erik Bärwaldt
Erik Bärwaldt has been working as an IT consultant for small businesses for more than two decades. In addition, he regularly publishes technical articles in various media on the topics of Linux, free software and IT security.
Continue Reading
Other languages
EXPERTE.com
EXPERTE.com helps with the selection of business software, tools and products through independent comparisons, guides and reviews. EXPERTE.com helps you to find the right solutions for the challenges of digital transformation.
Featured On