Diese Webseite nutzt nur technisch notwendige Cookies.

Pi Hole – How to Install on Raspberry Pi – 2024 Tutorial

Not in the mood for online advertising? (Spoiler: Pi Hole helps)

How can I block adverts in apps where no ad blocker is available?

I’ll show you the PI Hole, which bans such adverts forever.

Basics: What is the Pi Hole?

Pi Hole is a free software for blocking tracking and advertising URLs. The software was originally developed for the Raspberry Pi microcomputer, which is designed to encourage experimentation with software and hardware.

Dashbaord Pi Hole
Dashbaord Pi Hole

Your router uses the Pi Hole as a DNS server that blocks adverts and malicious domains. During installation, you integrate the Pi Hole into your private computer network and say bye-bye to advertising.

When resolving domain requests, Pi Hole filters out advertising and tracking. Your Pi Hole updates the new advertising URLs every day.

Isn’t an Ad Blocker for the Browser Enough?

The ad blocker in the browser does not remove adverts in apps/programs that run outside the browser.

Large advertising companies pay a lot of money to “Adblock Plus” to display a small proportion of “non-offensive” adverts.

Der Adblocker ist nicht gut
The adblocker is not good

Pi Hole protects you universally with a network firewall that protects all devices behind the firewall from the annoying adverts.

10 Reasons to use Pi Hole

Why should I use Pi Hole? Here I list a few advantages of Pi Hole, some of which are mentioned on their GitHub page:

  1. You don’t have to look at ads any more (Best ad blocker)
  2. The software protects you from malware advertising. Hackers buy adverts from advertising platforms to execute malicious code on your computer.
  3. Your websites load faster because Pi Hole caches the requested IPs for you. If Pi Hole does not know the requested URL, the DNS provider Cloudflare supports fast DNS resolution.
  4. You can observe and monitor all your network traffic. Watch how the big tech companies fail to spy on you with tracking software (insert evil laugh here).
    Internet Traffic auf der Fritzbox - Pi Hole Installation auf der Fritzbox Hacking Series Steffen Lippke
  5. The software interrupts the tracking of your devices for analysis tools with fingerprinting (user identification based on screen size, browser version, IP address, operating system version, cookies and other behaviour on a website)
  6. A loaner installs PI Hole in less than 10 minutes via the console
  7. The ad blocker blocks adverts outside the browser, e.g. in news apps
  8. Visualise DNS requests and activities via the dashboard with diagrams
  9. Suitable for IPv4 (old) and IPv6 (new)
  10. Not only suitable for Raspberry Pi, but the software is highly scalable for corporations based on more server performance

Limitations and Disadvantages of the Ad Blocker

Pi Hole is only almost a “god” ad blocker.

The software can only filter what is on the blacklist. The software lets unknown or new IPs through. No ad blocker in the world filters out adverts from videos (product influencers) or hard-coded adverts on websites.

Blocked Traffic URLs
Blocked Traffic URLs

Technologies PI Hole uses

Technically, the software uses dnsmasq, cURL, lighttpd, PHP and AdminLTE

DNS - Pi Hole Installation auf der Fritzbox Hacking Series Steffen Lippke
DNS – Installation on the Fritzbox Hacking Series Steffen Lippke
  • Dnsmaq converts the easily memorised URLs we know into an Internet Protocol address. This acts as a DNS cache to avoid lengthy DNS resolution.
  • cURL is a command line tool for using various Internet protocols such as HTTP, Telnet, Gopher, FTP..
  • lighttpd is a highly efficient, super lean web server with compression, URL rewriting and strong authentication.
  • PHP is a server-side programming language for dynamically displaying content on an HTML framework. A large part of the web (e.g. all WordPress blogs) use PHP.

Step-by-Step Tutorial for Pi Hole

All computers are suitable for the installation, especially Raspberry PI’s and microcomputers (for home use).

Prepare the Hardware

  1. Connect the mouse, keyboard and a monitor to the Raspberry Pi
  2. Activate the Secure Shell (SSH) with the start of the Raspberry Pi Configuration
    Preferences > Interfaces > Enable SSH
  3. Click on Ok
  4. Open the terminal and enter
    ipconfig
    and the IP address of the Raspberry Pi should display the console
  5. Optional: Physically move your Raspberry. You will need the power cable and a network cable or an activated W-Lan module on your Raspberry Pi to continue.

SSH and Installing the Software

  1. Download Putty for Windows
  2. Install Putty and start the software
  3. Enter the Raspberry Pi’s IP address (for Host Name) in the GUI of Putty and enter port 22 with Connection Type SSH.
  4. Save your SSH session
  5. Click on Open and you now have shell access to your PI if you enter the correct credentials. SSH is suitable for remote control of the PI.
  6. Type in
    sudo curl -sSL https://install.pi-hole.net | sudo bash
  7. Give your Pi time for the installation and follow the installation menu of the software. Confirm everything with “Yes” if you do not want any special configuration. (10 minutes)
  8. Go to the Windows browser and enter
    http://Pi-IP-ADRESSE-HIER/admin/index.php
    with the IP address of the PI. PI-Hole works so far.

Configuration of Your Router

  1. Log in to your router
    For Fritz!Box: http://fritz.box/
  2. Activate the extended view with the three dots at the top right
  3. Go to
    Internet > Access data > DNS server tab
  4. Enter there:
    Favourite DNSv4 server: Your Pi IPv4 address
    Alternative DNSv4 server: Cloudflare with 1.1.1.1
    Preferred DNSv6 server: Your PI IPv6 address
    Alternative DNSv6 server: Cloudflare with 2606:4700:4700::1111

    DNS - Pi Hole Installation auf der Fritzbox Hacking Series Steffen Lippke
  5. Take over
  6. Log out
  7. For testing, surf a few websites to generate some traffic
  8. Go to
    http://PI-IP-ADRESSE-HIER/admin/index.php
  9. The Pi should now block ad traffic.

How does Pi Hole Work? … with Blocklists!

The software blocks about 90,000 DNS advertising requests from the start if you work with the standard configuration.

Update Prozess Pi Hole - Pi Hole Installation auf der Fritzbox Hacking Series Steffen Lippke
Update process

I have compiled a file with various sources (2,900,000 entries).

The file contains 99 URLs to text files on GitHub that list URLs that should be blocked.

What is on the list?

  • Advertising platforms for displaying user-specific adverts with advertising IDs and tracking (Google AdSense, affiliate stuff)
  • Fingerprinting, tracking, analysis software for tracking users (Google Analytics, other analysis software, in-app analysis)
  • Known malicious websites that contain malware, viruses, Trojans, etc. (Provided on AWS)
Was ist in meinem Netzwerk -  Installation auf der Fritzbox Hacking Series Steffen Lippke
What is in my network

Alternative Projects Firewall with Raspberry Pi

ipFire is an open source project that divides your network into different zones (Demilitarised Zone and Local Area Network). The software uses Stateful Packet Inspection (SPI) based on an IP filter.

With the firewall, you can mitigate or completely block DDoS attacks to prevent your server from going down.

If you are not working from home, you can use VPN to connect securely to your home network. ipFire uses ipSec and OpenVPN.

You can convert the software into a TOR node, use it as a backup server or expand it into a wireless access point.

Let us know what you think! Was this tutorial/post helpful, or do you still have burning questions? Write a comment and become part of our growing community. Share your successes, challenges and tips - together we can achieve great things in security and coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

get rss abo

Jetzt
Abbonnieren
academy

Erhalte Free
Security Kurs

Jeden Monat teile ich mit Mitgliedern
4 neue praxisnahe Tutorials (je 1000+ Wörter).


Trage Deine Mail, damit Du
Deine Coding + Hacking Skills erweitern kannst!