Pi-hole
Network-Wide Ad Blocking via Your Own DNS Server
Network-Wide Ad Blocking via Your Own DNS Server
Pi-hole is a network-level advertisement and internet tracker blocking application that acts as a DNS sinkhole. Instead of installing ad blockers on every device, Pi-hole blocks ads for your entire network from a single location.
By intercepting DNS requests, Pi-hole prevents ads, tracking domains, and malicious sites from loading on any device connected to your network – phones, tablets, smart TVs, IoT devices, and computers. Even devices that don’t support browser extensions benefit from Pi-hole’s protection.
Originally designed for the Raspberry Pi (hence the name), Pi-hole runs on virtually any Linux system, in Docker, or even in a VM. It’s lightweight, fast, and provides detailed statistics about your network’s DNS queries.
Block ads on every device on your network automatically. No software installation needed on client devices. Protects smartphones, smart TVs, and IoT devices.
Pages load faster without ads and trackers. Reduce bandwidth usage. Improve privacy by blocking tracking domains at the DNS level.
Beautiful dashboard showing blocked queries, top domains, client activity, and query types. Understand your network’s DNS traffic.
Web-based admin interface for easy configuration. Whitelist/blacklist domains with a click. Update blocklists automatically.
Runs on Raspberry Pi Zero with minimal resources. Uses ~50MB RAM. Perfect for repurposing old hardware or running alongside other services.
100% free forever with active community development. No subscriptions, no limits. Full control over your DNS filtering.
Deploy Pi-hole using Docker for easy setup and management.
Create directories to store Pi-hole configuration:
mkdir -p ~/pihole/{etc-pihole,etc-dnsmasq.d}
cd ~/pihole
Create docker-compose.yml with the following configuration:
version: '3'
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "80:80/tcp"
environment:
TZ: 'America/New_York'
WEBPASSWORD: 'your_secure_password'
FTLCONF_LOCAL_IPV4: '192.168.1.100' # Your server's IP
PIHOLE_DNS_: '1.1.1.1;1.0.0.1' # Upstream DNS servers
DNSSEC: 'true'
DNSMASQ_LISTENING: 'all'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
cap_add:
- NET_ADMIN
dns:
- 127.0.0.1
- 1.1.1.1
Launch Pi-hole container:
docker-compose up -d
Open your browser and navigate to:
http://your-server-ip/admin
Login with the password you set in WEBPASSWORD environment variable.
Option A: Router-Wide (Recommended)
Option B: Per-Device Configuration
Manually set DNS on each device to your Pi-hole IP address.
http://pi.hole/admin (works if DNS configured correctly)DNS Port: 53
Web UI Port: 80
Important: Port 53 must be free on host!
Tip: Use static IP for Pi-hole server!
Default Login:
admin / (your password)
Pi-hole comes with default blocklists, but you can add more:
After adding blocklists, update gravity database:
docker exec pihole pihole -g
Whitelist (Allow domains):
Blacklist (Block domains):
Advanced users can use regex patterns:
The Pi-hole dashboard provides real-time insights:
Pi-hole stores historical data for analysis:
Access Pi-hole data programmatically:
Resolve local hostnames from your router:
Create custom DNS entries for local services:
Configure where Pi-hole forwards queries:
Customize the page users see when accessing blocked domains.
Website not loading:
Check query log to see if domain is blocked. Whitelist if needed. Clear browser cache.
No queries showing:
Verify DNS is set to Pi-hole IP. Check pihole container is running. Verify port 53 is accessible.
Slow DNS resolution:
Try different upstream DNS servers. Check network latency. Reduce blocklist size.
Port 53 already in use:
Stop systemd-resolved or other DNS service using port 53.
Update Pi-hole regularly:
docker-compose pull docker-compose down docker-compose up -d
Update gravity (blocklists):
docker exec pihole pihole -g
Backup Pi-hole settings from web interface:
Deploy Pi-hole and enjoy faster, cleaner, more private browsing on all your devices.
Pi-hole is open-source software. Visit pi-hole.net for documentation, community support, and donations.