Setup and run Pi-Hole on a Raspberry Pi (2024)

Blocking ads and trackers on your devices typically requires manual labour on each individual device (e.g. installing an ad-blocker on your browser, another on your phone, and another on your tablet). In this guide you'll learn how to install and setup Pi-Hole, a general purpose network-wide ad-blocker, on a Raspberry Pi to block ads on any device connected to your home network.

Last modified

12th January 2022

Guide level

Advanced

Overview

Pi-hole is a general purpose network-wide ad-blocker that protects your network from ads and trackers without requiring any setup on individual devices. It is able to block ads on any network device (e.g. smart appliances), and, unlike browser add-ons, Pi-hole blocks ads on any type of software.
The general setup works as follows (Fig. 1). You install Pi-hole on your server (in this case, we're using a Raspberry Pi) and assign it a static IP address. On your router, you set the DNS primary server to the Pi-hole IP address. When a device connects to your home network, it gets the Pi-hole IP address as its main DNS server from your router. When your device looks up the address for a hostname, it contacts the Pi-hole. If the host is an ad or tracker and present in the list used, the request is instantly blocked. Otherwise, the lookup is performed on some upstream server of your choice (e.g. OpenDNS, Cloudflare, GoogleDNS, your ISP).

Fig. 1: Pi-hole setup overview

Prerequisites

To deploy Pi-hole on your home network, make sure you have all of the following:

  • A Raspberry Pi with at least 512MB of RAM (all Raspberry Pi versions satisfy this requirement) and Raspbian installed.
  • An SD-card with at least 2GB of free space.
  • Internet connection on your Raspberry Pi. Either via Wi-Fi (if available) or via Ethernet cable.
  • Access to your router's administration panel[^1].

[^1]: This is usually available in home networks. Check your router's documentation for instructions and credentials.

Installation

Disclaimer: This guide is based on the official Pi-hole documentation but might not be up to date. This guide is more about giving an understanding of what pi-hole does and how you might want to configure it than a strict step by step guide. For up to date instructions on how to install and any specific issue please refer to the official documentation.

If you're starting with a fresh Raspberry Pi, start by installing Raspbian according to the Raspberry Pi documentation. Then, be sure to install git with the following command:
sudo apt install git
To install Pi-hole, you'll clone its git repository and run the install script.
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd "Pi-hole/automated install/"
sudo basic-install.sh
The script will guide you through the installation steps and ask for your input to configure basic settings. Any settings you configure during installation can be updated later. At some point, it asks you to select an upstream DNS provider (Fig. 2). This is the server on which lookups of non-blocked hostnames will be performed.

Fig. 2: Select upstream DNS

Then, it will ask you to select an adlist. We suggest you leave the default on (Fig. 3). Later, you'll be able to add more lists, including custom ones, if you wish to.

Fig. 3: Pi-hole adlist selection

Pi-hole is able to block ads on IPv4 and IPv6. Unless you have a specific reason to disable any of those protocols, you can leave both on (Fig. 4).

Fig. 4: Pi-hole protocol selection

It also includes a web interface which you can access to manage your Pi-hole instance. If you're comfortable with command line usage, you can skip the web interface (and server) installation. Otherwise, we suggest you install it (Fig. 5), as well as the corresponding web server (Fig. 6).

Fig. 5: Install web interface

Fig. 6: Install web server

You can choose to log the queries answered by your Pi-hole (Fig. 7), and set a privacy level dictating which kind of logs are stored (Fig. 8). If you're sharing your Pi-hole instance with other people, beware that logs may leak private information (that will be visible to you), so choose your privacy levels accordingly.

Fig. 7: Set query logs

Fig. 8: Set log privacy level

When the installation is finished, you'll get a summary message that includes the IP addresses of your Pi-hole and the randomly generated admin password (Fig. 9). Be sure to save this somewhere (either screenshot or pen & paper) as you'll need it later.

Fig. 9: Pi-hole installation summary

Click OK to conclude the installation. To be sure the installation succeeded, open a web browser and go to http://IP_ADDRESS/admin, where IP_ADDRESS is the IPv4 address of your Pi-hole device (Fig. 9). Note that the http://pihole/admin only works after you setup your device to use the Pi-hole DNS server. Click on log-in and enter your (randomly-generated) password. You should now be in the Pi-hole admin panel (Fig. 10).

Fig. 10: Pi-hole admin panel

Setup

Now that you have Pi-hole installed, the last step is configuring your network to use Pi-hole as its DNS server
The preferred method for doing this is to change your router's DNS server and point it to the Pi-hole IP address, ensuring any client that connects to your network receives the Pi-hole as its DNS server. Typically this requires you to access the router's administration panel. There, you should have a field to set the primary and secondary DNS servers. Set the primary address to the Pi-hole's IP address, and reset any open network connection you may have on your devices. Now, when you connect to your home network, you should get the Pi-hole as the DNS server.
However, some routers do not allow you to change the DNS settings. In this case, you can set the Pi-hole as your DHCP server (and in doing so, you need to disable your router's own DHCP server). Refer to the official Pi-hole documentation to learn how to do so.

Guide

Protect yourself from online tracking

Learn more

AdTech

Found a mistake? An outdated screenshot? Think this could be improved? Check out our Github repository and contribute to help keep these guides up-to-date and useful!

Setup and run Pi-Hole on a Raspberry Pi (2024)

FAQs

Do I need Raspberry Pi to run Pi-hole? ›

Despite the name, you are not limited to running Pi-hole on a Raspberry Pi. Any hardware that runs one of the supported operating systems will do!

What is the minimum Raspberry Pi for Pi-hole? ›

You can use any Raspberry Pi model for this. We recommend Zero 2 W if you can't decide which model to use.

Which Raspberry Pi OS for Pi-hole? ›

I recommend you go with Raspberry Pi OS Lite (32-Bit) as you will not need a desktop environment at all. Be sure to choose the correct storage device. Be aware of the devices that are in your computer. I know that the SD card I have chosen is 32 GB so that is the one I am going to select.

Does Pi-hole slow wifi? ›

The only way for Pi-hole to slow down your network is if you've set up something to route all traffic via the Pi-hole server. Pi-hole only handles DNS queries, there is no way for it to slow down the internet connection at all, it doesn't see or handle any traffic other than DNS queries.

How much RAM does Pi-hole need? ›

Pi-hole needs a minimum of 512 MB of RAM (I repeat, a minimum and that's just for Pi-hole).

What hardware is needed for Pi-hole? ›

We recommend the Raspberry Pi 3 Model B+ because it works well as a fanless computer with no moving parts. For storage the SanDisk Extreme MicroSD 32GB or larger. We also recommend the see-through Zebra Classic Case from C4 Labs.

How many cores does a Pi-hole need? ›

Pihole-FTL only utilizing single core.

What can Pi-hole block? ›

Pi-hole functions similarly to a network firewall, meaning that advertisem*nts and tracking domains are blocked for all devices behind it, whereas traditional advertisem*nt blockers only run in a user's browser, and remove advertisem*nts only on the same machine.

Is it bad to run a Raspberry Pi 24 7? ›

Yes, it is completely normal to run a Pi 24/7. Even for years at a time. They use so little power that its not worth turning them off when not in use.

How long will a Raspberry Pi last? ›

How long is the lifespan of a raspberry pi? Lifespan should be exactly the same as any other computer. Most run for more than 10 years. Capacitors are what usually go bad and there aren't many on the Pi.

Is Pi-hole free? ›

Pi-hole is free, but powered by your support.

How to setup Raspberry Pi for Pi-hole? ›

Setup Procedure
  1. Write the OS Image. Write the Raspberry Pi OS image onto the memory card. ...
  2. Boot Up. Insert the memory card into the Pi and boot it up.
  3. Attach to the Network. After a few minutes of the Pi running, attach the network cable. ...
  4. IP Address. Find the Pi's IP address. ...
  5. SSH. ...
  6. Update. ...
  7. Install Pi-hole. ...
  8. Password Update.
Feb 22, 2024

What is Raspberry alternative for Pi-hole? ›

Alternatives to Pi-hole
  • AdGuard DNS. AdGuard. ...
  • Surfshark. Surfshark. ...
  • Maza. Andros Fenollosa. ...
  • Alternate DNS. Alternate DNS. ...
  • Ka-Block! Ka-Block! ...
  • Metiix Blockade. Metiix. ...
  • Total Adblock. Total Adblock. ...
  • AdClear. SEVEN Networks.

What OS should I use for Pi-hole? ›

If it's a Raspberry Pi then Pi OS (was Raspbian) is well supported. On my Raspberry Pi 3b I am using Debian, started with Debian 10 now 11. I chose DietPi OS (~130MB file) as my OS and then installed Pi_Hole.

How do I set up Pi-hole on my computer? ›

Step by step instructions
  1. Step 1 - Download and install Docker for Windows. ...
  2. Step 2 - Download Pi-hole. ...
  3. Step 3 - Give your PC a static IP address. ...
  4. Step 4 - create a customized Docker command. ...
  5. Step 5 - run your script and start your Pi-hole server. ...
  6. Step 6 - Check Pi-hole is up and running. ...
  7. Step 7 - Configure your router.
Mar 13, 2022

How do I setup my router for Pi-hole? ›

Situation 1: Set up Pi-Hole DNS on the wireless router.

Click on Advanced > Network > DHCP server > Enter the Pi-Hole DNS in the Primary DNS blank > Click on Save to save the changes> Click on Reboot so that your devices will reconnect to the TP-Link router's network and start to use the Pi-Hole DNS.

How do I set up a PI connector? ›

  1. Workflow for configuring data flow. Request registration from a connector to. Start PI Data Collection Manager. PI Data Collection Manager component status. Authorize a connector. Delete an authorized connector. ...
  2. Stop or start connector data collection.
  3. Revoke or reinstate OMF application data ingress.
  4. Lost connections.
Jul 31, 2024

How do I use my Raspberry Pi for the first time? ›

  1. 1 Insert SD card. See page 3 for how to. ...
  2. 3 Connect input. Plug in a USB keyboard. ...
  3. 4 Connect network. Connect to your wired. ...
  4. 5 Power up. Plug in the micro USB. ...
  5. Download the Raspberry Pi operating system. ...
  6. Unzip the file that you just downloaded. ...
  7. Download the Win32DiskImager software. ...
  8. Writing Raspbian to the SD card.

Top Articles
Learn How To Trade With Inside Bar Trading Pattern
Mutual Funds: Best Mutual Funds to invest in 2023, Mutual funds review and News | ET Mutual Funds Analysis
Craigslist Livingston Montana
Foxy Roxxie Coomer
Encore Atlanta Cheer Competition
Dairy Queen Lobby Hours
Euro (EUR), aktuální kurzy měn
What is Mercantilism?
Voorraad - Foodtrailers
Sportsman Warehouse Cda
Premier Boating Center Conroe
Large storage units
Urban Dictionary Fov
Nitti Sanitation Holiday Schedule
Maplestar Kemono
Wal-Mart 140 Supercenter Products
Kylie And Stassie Kissing: A Deep Dive Into Their Friendship And Moments
Jang Urdu Today
Nordstrom Rack Glendale Photos
Culver's Flavor Of The Day Taylor Dr
The Weather Channel Local Weather Forecast
Soulstone Survivors Igg
Marion City Wide Garage Sale 2023
PCM.daily - Discussion Forum: Classique du Grand Duché
R/Airforcerecruits
Xxn Abbreviation List 2023
Pioneer Library Overdrive
Hannah Jewell
The Rise of "t33n leaks": Understanding the Impact and Implications - The Digital Weekly
Delta Rastrear Vuelo
Hotel Denizen Mckinney
Baddies Only .Tv
Att U Verse Outage Map
El agente nocturno, actores y personajes: quién es quién en la serie de Netflix The Night Agent | MAG | EL COMERCIO PERÚ
Selfservice Bright Lending
Free Robux Without Downloading Apps
Helloid Worthington Login
Why The Boogeyman Is Rated PG-13
How Much Is Mink V3
To Give A Guarantee Promise Figgerits
Leatherwall Ll Classifieds
The Complete Guide To The Infamous "imskirby Incident"
Dmitri Wartranslated
Busch Gardens Wait Times
Telugu Moviez Wap Org
Sam's Club Gas Prices Florence Sc
Dragon Ball Super Super Hero 123Movies
Plumfund Reviews
Joy Taylor Nip Slip
Edt National Board
Latest Posts
Article information

Author: Lilliana Bartoletti

Last Updated:

Views: 6732

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Lilliana Bartoletti

Birthday: 1999-11-18

Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

Phone: +50616620367928

Job: Real-Estate Liaison

Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.