Installing Pi-hole

Network-wide ad and tracker blocking through a DNS sinkhole. Block thousands of domains across every device on your network without touching any of them.

DNS Sinkhole Ad Blocking Free & Open Source Pi-hole v6

What is Pi-hole?

Pi-hole acts as your network's DNS server. When any device on your network tries to look up an ad-serving or tracking domain, Pi-hole intercepts that DNS request and returns nothing — the ad never loads. Unlike browser extensions, Pi-hole works on every device including smart TVs, phones, game consoles, and IoT devices.

Works on any Linux machine — not just Raspberry Pi. Works great on Pi 4, Pi 5, Zero 2W, or any Ubuntu/Debian server.

Prerequisites

Hardware
Any Raspberry Pi (Zero 2W or better recommended), or any Linux PC/VM
OS
Raspberry Pi OS Lite (64-bit recommended), Ubuntu 22.04+, or Debian 11+
Network
Static IP address on your Pi (wired recommended for reliability)
Access
SSH access to your Pi, or a connected keyboard and monitor

Step-by-Step Installation

01

Set a Static IP Address

Pi-hole needs a stable IP so your router can point DNS traffic at it reliably. Edit your DHCP settings or set a static IP on the Pi itself.

# Check your current IP
ip addr show

# For a static IP on Raspberry Pi OS, edit:
sudo nano /etc/dhcpcd.conf

# Add at the bottom (adjust to your network):
interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=127.0.0.1
02

Update Your System

Always start with a fresh, fully updated system.

sudo apt update && sudo apt full-upgrade -y
sudo reboot
03

Run the Pi-hole Installer

Pi-hole provides a one-line installer. It will walk you through a guided setup wizard.

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

During setup: choose your upstream DNS provider (e.g. Cloudflare 1.1.1.1), confirm your static IP, and note down the web admin password shown at the end.

04

Access the Web Interface

Once installed, open a browser and navigate to the Pi-hole admin panel:

http://192.168.1.100/admin
# or
http://pi.hole/admin

Log in with the password shown during installation. You can change it with:

pihole -a -p
05

Point Your Router's DNS to Pi-hole

Log into your router admin panel and change the DNS server to your Pi's static IP. This makes every device on your network automatically use Pi-hole.

📍 Location varies by router: usually under LAN Settings → DHCP Server → DNS. Set Primary DNS to your Pi-hole IP (e.g. 192.168.1.100).

06

Add Blocklists

Pi-hole comes with the default blocklist, but you can add more for better coverage.

# Go to: Admin → Adlists
# Add lists like:
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/lists.php?type=tick

# Then update gravity (rebuild the blocklist database):
pihole -g
07

Verify It's Working

# Test a known ad domain (should return 0.0.0.0):
nslookup doubleclick.net 192.168.1.100

# Check Pi-hole status:
pihole status

# View live query log:
pihole -t

Useful Commands

TaskCommand
Update Pi-holepihole -up
Rebuild blocklistpihole -g
Disable temporarilypihole disable 10m
Re-enablepihole enable
Live query logpihole -t
Change passwordpihole -a -p
Check versionpihole version
Whitelist domainpihole -w example.com
Blacklist domainpihole -b example.com

Pair Pi-hole with Unbound

For maximum privacy, pair Pi-hole with Unbound as its upstream resolver. Instead of sending queries to Cloudflare or Google, Unbound resolves them directly from root servers — no third party ever sees your DNS traffic.

➡️ See the Unbound setup guide for integration instructions.