Pi-hole Installation Guide for Raspberry Pi
15 viewsWhat is Pi-hole?
Pi-hole is a network-wide ad blocker that acts as a local DNS server. Instead of installing ad blockers on every device, you install Pi-hole once — and it filters everything.
Requirements
- Raspberry Pi 5 with Raspberry Pi OS installed
- Static IP address (recommended)
- Terminal or SSH access
- Router access (to change DNS settings)
Step 1: Update the system
sudo apt update && sudo apt upgrade -y
Step 2: Set a static IP address (recommended)
Edit your DHCP configuration (if not already static):
sudo nano /etc/dhcpcd.conf
Uncomment and configure lines like this:
interface eth0 static ip_address=192.168.1.100/24 static routers=192.168.1.1 static domain_name_servers=127.0.0.1
Then reboot:
sudo reboot
Step 3: Install Pi-hole (Official method)
Run the automated install script:
curl -sSL https://install.pi-hole.net | bash
Follow the setup steps:
- Choose your network interface (usually
eth0
) - Choose an upstream DNS provider (like Cloudflare or Google)
- Leave the default blocklists selected
- Enable the web admin interface
- Select “Yes” for logging and privacy
Step 4: Access the web interface
After installation, open a browser and visit:
http://<YOUR_PI_IP>/admin
Log in using the password shown at the end of installation.
If you forgot it, reset with:
pihole -a -p
Step 5: Configure your router
Log into your router and set your Pi-hole’s IP as the primary DNS server for your network (e.g. 192.168.1.100
).
This will send all DNS queries through your Pi-hole.
Optional: disable IPv6 DNS if your router doesn’t support filtering it.
Step 6: Use it
That's it — Pi-hole is now protecting your entire network from ads and trackers.
You can:
- Monitor queries in real time via the web interface
- Whitelist or blacklist domains
- Add extra blocklists
Useful commands
-
Update Pi-hole:
pihole -up
-
Restart service:
pihole restartdns
-
View top blocked domains:
pihole top