← How-Tos
raspberry-pi Mar 29, 2026 ◯ 2 min read

How to Install and Configure Pi-hole on Raspberry Pi

raspberry pipi holednsad blockingnetworkhome network

Pi-hole is a network-wide DNS ad blocker. It runs on a Raspberry Pi and blocks ads, trackers, and malicious domains for every device on your network — no browser extension needed.

Requirements

Step 1 — Give the Pi a Static IP

Pi-hole needs a static IP so other devices always know where to send DNS requests.

Option A — Set in your router DHCP reservations (easiest).

Option B — Set in the Pi itself:

sudo nano /etc/dhcpcd.conf

Add at the bottom:

interface eth0
static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Save, then sudo reboot.

Step 2 — Install Pi-hole

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

The installer walks through a GUI in the terminal:

Note the admin password at the end — or reset it with pihole -a -p newpassword.

Step 3 — Point Your Network to Pi-hole

In your router settings, change the Primary DNS to your Pi's static IP (e.g., 192.168.1.10). Leave Secondary DNS blank or set to 1.1.1.1 as fallback.

Alternatively, configure individual devices to use the Pi as their DNS server.

Step 4 — Access the Dashboard

Open a browser and go to:

http://192.168.1.10/admin

Log in with your password. You'll see queries, blocked percentage, top domains, and more.

Useful Commands

# Check Pi-hole status
pihole status

# Update Pi-hole
pihole -up

# Temporarily disable (10 minutes)
pihole disable 10m

# Re-enable
pihole enable

# Add domain to whitelist
pihole -w example.com

# View live query log
pihole -t

Adding More Blocklists

In the admin panel: Group Management → Adlists

Good lists to add:

After adding lists: Tools → Update Gravity to rebuild the database.

Tips