Situatie
Pi-hole is a network-wide ad blocker that acts as a DNS sinkhole. By running it on a Raspberry Pi, you can block ads and trackers for all devices on your network without needing browser extensions.
Solutie
1. Prerequisites
Hardware
-
Raspberry Pi (any model works, but Pi 3 or newer is recommended)
-
microSD card (8GB minimum, Class 10 recommended)
-
Power supply for the Raspberry Pi
-
Ethernet cable (recommended for stability) or Wi-Fi
-
Optional: Case for the Pi
Software
-
Raspberry Pi OS (Lite version recommended for headless setup)
-
SSH enabled (if setting up without monitor/keyboard)
2. Prepare the Raspberry Pi
Step 2.1 – Flash Raspberry Pi OS
-
Download Raspberry Pi Imager:
https://www.raspberrypi.com/software/ -
Insert your microSD card and select:
-
OS: Raspberry Pi OS Lite (32-bit)
-
Storage: Your SD card
-
-
Click Advanced Options (gear icon):
-
Set hostname (e.g.,
raspberrypi
) -
Enable SSH
-
Set username/password
-
Configure Wi-Fi (if not using Ethernet)
-
-
Flash and eject the card.
Step 2.2 – Boot and Update
-
Insert the microSD card into the Pi and power it on.
-
Connect via SSH:
-
Update packages:
3. Install Pi-hole
Pi-hole has a one-step installation script.
Step 3.1 – Installation Walkthrough
The installer will ask for several settings:
-
Static IP address
-
Recommended to assign a static IP in your router’s DHCP settings.
-
Pi-hole can also set a static IP locally.
-
-
Upstream DNS provider
Common choices:-
Cloudflare (1.1.1.1)
-
Google (8.8.8.8)
-
Quad9 (9.9.9.9)
-
Or a custom one.
-
-
Blocklists
-
Pi-hole comes with a default blocklist; you can add more later.
-
-
IPv4/IPv6
-
Enable both if your network supports IPv6.
-
-
Admin Web Interface
-
Highly recommended — lets you monitor queries and add/remove blocklists easily.
-
-
Logging and Privacy Mode
-
Choose how much detail you want stored.
-
4. Post-Installation Configuration
After installation, Pi-hole will give you:
-
Web interface address:
http://<PI_IP_ADDRESS>/admin
-
Admin password (write this down)
Step 4.1 – Set Static IP
If not done in your router:
Add lines:
Save & reboot:
Step 4.2 – Access Web Dashboard
-
Go to:
http://<PI_IP_ADDRESS>/admin
-
Log in using the password given at the end of installation.
-
Check query logs and status.
Step 4.3 – Point Devices to Pi-hole
Two main ways:
-
Router-level DNS (recommended)
-
In your router’s admin page, set Primary DNS to your Pi-hole’s IP.
-
All devices will use Pi-hole automatically.
-
-
Device-level DNS
-
Set DNS manually in each device’s network settings.
-
Step 4.4 – Adding More Blocklists
In the Pi-hole dashboard:
-
Settings → Blocklists → Add URL
Example: -
Update gravity:
5. Maintenance Commands
Command | Description |
---|---|
pihole -g |
Update blocklists |
pihole -up |
Update Pi-hole |
pihole enable |
Re-enable blocking |
pihole disable [seconds] |
Temporarily disable |
pihole -t |
Live query log |
6. Security Recommendations
-
Change the admin password:
-
Keep Pi-hole and Raspberry Pi OS updated:
- Avoid exposing the Pi-hole web interface to the internet.
Leave A Comment?