π Official Resources
GitHub Repository | v6 Migration Guide
Recommended Hardware: Raspberry Pi 4 Kit (8GB) with NVMe SSD via USB 3.0
Looking for a comprehensive setup guide?
Check out TimInTech/Pi-hole-Unbound-PiAlert-Setup for a step-by-step guide to setting up Pi-hole with Unbound (for DNS over TLS) and PiAlert (for monitoring and alerts).
# Example: Custom regex for social media blocking in v6
pihole -regex '(^|\.)(tiktok|instagram|snapchat)\.(com|net)$'
- Context-Aware Blocking
Granular control via regex 2.0 engine supporting negative lookaheads and domain hierarchy analysis. - Dynamic Gravity Sync
Blocklists now update incrementally - 70% faster than v5's full-database rewrites.
- FTL DNS v3.0
Multi-threaded resolver with adaptive cache (up to 500,000 entries) reduces latency to <15ms for 95% of queries. - Hardware-Accelerated Cryptography
ARM64 builds leverage Raspberry Pi 4's NEON extensions for 3x faster DNSSEC validation.
-
Update System Packages
Ensure your system is up-to-date:sudo apt update && sudo apt upgrade -y
-
Install Pi-hole
Use the automated installer:curl -sSL https://install.pi-hole.net | bash
Follow the on-screen instructions to complete the installation.
-
Set a Static IP Address
To avoid DNS resolution issues, configure a static IP for your Raspberry Pi:sudo nano /etc/dhcpcd.conf
Add the following lines (adjust according to your network):
interface eth0 static ip_address=192.168.1.100/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1
-
Configure IPv6 (Optional)
If you use IPv6, ensure privacy extensions are disabled:sudo nano /etc/sysctl.conf
Add the following line:
net.ipv6.conf.all.accept_ra=0
-
Reboot the System
Apply changes:sudo reboot
-
Install Docker
Install Docker and Docker Compose:sudo apt update sudo apt install docker.io docker-compose -y
-
Create a Docker Network
Set up a dedicated network for Pi-hole:docker network create pihole_network
-
Run Pi-hole in Docker
Use the following command to start Pi-hole in a Docker container:docker run -d --name pihole \ --network pihole_network \ -e TZ="America/New_York" \ -e WEBPASSWORD="encrypted_sha256_hash_here" \ -v "$(pwd)/etc-pihole/:/etc/pihole/" \ -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \ --dns=127.0.0.1 --dns=1.1.1.1 \ --hostname pi.hole \ -e VIRTUAL_HOST="pi.hole" \ -e PROXY_LOCATION="pi.hole" \ -e ServerIP="127.0.0.1" \ pihole/pihole:latest
-
Verify Installation
Check if the container is running:docker ps
-
Access the Web Interface
Open your browser and navigate tohttp://pi.hole/admin
to access the Pi-hole dashboard.
For a more structured setup, use Docker Compose:
-
Create
docker-compose.yml
Save the following configuration in a file nameddocker-compose.yml
:version: '3.7' services: pihole: image: pihole/pihole:v6.0 networks: pihole_net: ipv4_address: 192.168.1.100 ipv6_address: fd00:dead:beef::100 environment: TZ: 'America/New_York' WEBPASSWORD: 'encrypted_sha256_hash_here' DNSMASQ_LISTENING: 'all' volumes: - './etc-pihole:/etc/pihole' - './etc-dnsmasq.d:/etc/dnsmasq.d' cap_add: - NET_ADMIN restart: unless-stopped networks: pihole_net: driver: bridge enable_ipv6: true ipam: config: - subnet: 192.168.1.0/24 - subnet: fd00:dead:beef::/64
-
Start the Container
Run the following command in the directory containingdocker-compose.yml
:docker-compose up -d
-
Verify and Access
Check the container status and access the web interface as described above.
sqlite3 /etc/pihole/gravity.db "INSERT INTO adlist (address, enabled) VALUES ('https://github.com/raw/StevenBlack/hosts/master/hosts', 1);"
pihole -g
- Regular Updates: Schedule regular updates for your blocklists to ensure they are up-to-date.
pihole -g
- Custom Blocklists: Create your own blocklists for specific needs.
- Whitelist Important Domains: Avoid over-blocking by whitelisting essential domains.
sqlite3 /etc/pihole/gravity.db "INSERT OR IGNORE INTO domainlist (domain, enabled, type) VALUES ('example.com', 1, 0);"
- Specific Subdomain Whitelisting:
pihole -w sub.example.com
- Streaming Service Allowlisting: If Netflix, Spotify, or YouTube are blocked, check their CDN domains (
cdn.netflix.com
,spotify.com
,youtube.com
) and whitelist them.
- Monitor Whitelist: Regularly review your whitelist to ensure it contains only necessary domains.
- Use Wildcards: For broader allowances, use wildcard entries (e.g.,
*.example.com
).
# /etc/dnsmasq.d/06-ipv6.conf
dhcp-range=::100,::200, constructor:eth0, 64, 12h
dhcp-option=option6:dns-server,[fd00:dead:beef::100]
dhcp-option=option6:domain-search,home.lan
-- Query IPv6 adoption rates
SELECT
strftime('%Y-%m-%d', datetime(timestamp, 'unixepoch')) AS day,
COUNT(*) FILTER (WHERE type = 'A') AS ipv4,
COUNT(*) FILTER (WHERE type = 'AAAA') AS ipv6
FROM queries
GROUP BY day;
# Get access token
curl -X POST https://pi.hole/admin/api/auth/login \
-H "Content-Type: application/json" \
-d '{"password":"your_web_password"}'
# Example: Block TikTok via API
curl -X POST https://pi.hole/admin/api/block \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domains": ["tiktok.com", "tiktokv.com"],
"comment": "Social media block",
"list": "default"
}'
Endpoint | Method | Description |
---|---|---|
/admin/api/summary |
GET | 60+ metrics in single JSON response |
/admin/api/top_clients |
GET | Top 10 IPv6/IPv4 requesters |
/admin/api/network |
PUT | Update DNS resolvers without restart |
# Block IPv6 tracking domains
||ipv6-tracker.example^$dnstype=AAAA
# Allow Microsoft IPv6 endpoints
@@||azure.ipv6.microsoft.com^$dnstype=AAAA
# Rollback to previous blocklist state
pihole -g --rollback
# Set up automated git-based tracking
sudo crontab -e
0 3 * * * /usr/local/bin/pihole -g && cd /etc/pihole && git commit -am "Daily blocklist update"
# Check IPv6 query handling
pihole -c -6
# Audit API access logs
journalctl -u pihole-FTL -f | grep 'API_AUTH'
# Test regex filtering latency
pihole -t -ex '^.*doubleclick.net$'
-
RA (Router Advertisement) Conflicts
Disable competing IPv6 routers:
sysctl -w net.ipv6.conf.all.accept_ra=0
-
SLAAC vs DHCPv6
Ensure consistent address assignment method network-wide -
DNS64/NAT64 Compatibility
Adddns64
toPIHOLE_DNS_
environment variables
For common Pi-hole v6 issues and solutions, check out the Troubleshooting Guide.