Communitygithub.com

Homelab Pi-hole DNS

Pi-hole-Installation, Blocklist-Verwaltung, DNS-over-HTTPS-Einrichtung, DHCP-Integration, lokale DNS-Einträge und Fehlerbehebung bei unterbrochener DNS-Auflösung im Heimnetzwerk. Verwende dieses Skill, wenn die Aufgabe explizit Pi-hole betrifft – Installation, Blocklist-Verwaltung, DoH- oder DHCP-Konfiguration, lokale DNS-Einträge oder Diagnose von DNS-Problemen mit Pi-hole.

Was ist Homelab Pi-hole DNS?

Dieses Skill bietet eine umfassende Anleitung zur Installation und Verwaltung von Pi-hole, einem netzwerkweiten DNS-Werbeblocker, der auf einem Raspberry Pi oder einem anderen Linux-Host läuft. Es ermöglicht die automatische Blockierung von Werbe- und Malware-Domains für alle Geräte im Netzwerk, ohne dass Browsererweiterungen erforderlich sind. Das Skill deckt Installation über Docker oder bare-metal ab, die Konfiguration des Netzwerks zur Nutzung von Pi-hole, Verwaltung von Blocklisten, Einrichtung von DNS-over-HTTPS (DoH) mit Cloudflared, Erstellung lokaler DNS-Einträge und Fehlerbehebung bei DNS-Problemen. Es unterstützt Benutzer bei der Integration von Pi-hole in Heimnetzwerke, einschließlich DHCP-Konfiguration, und gibt Best Practices für eine zuverlässige und sichere DNS-Infrastruktur.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/homelab-pihole-dns

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht Homelab Pi-hole DNS?

Pi-hole ist ein netzwerkweiter DNS-Werbeblocker, der auf einem Raspberry Pi oder einem anderen Linux-Host läuft. Jedes Gerät in deinem Netzwerk erhält automatisch Werbe- und Malware-Domainblockierung – ohne Browsererweiterung.

Wann verwenden

  • Installation von Pi-hole auf einem Raspberry Pi oder Linux-Host
  • Konfiguration von Pi-hole als DNS-Server für ein Heimnetzwerk
  • Hinzufügen oder Verwalten von Blocklisten
  • Einrichtung von DNS-over-HTTPS (DoH) als Upstream-Resolver
  • Erstellen lokaler DNS-Einträge (z.B. nas.home.lan, pi.home.lan)
  • Fehlerbehebung bei Geräten, die nach der Pi-hole-Installation keinen Internetzugang mehr haben
  • Betrieb von Pi-hole neben oder anstelle von DHCP

Wie Pi-hole funktioniert

Normaler Ablauf (ohne Pi-hole):
  Gerät → Anfrage ads.tracker.com → ISP-DNS → echte IP → Werbung lädt

Mit Pi-hole:
  Gerät → Anfrage ads.tracker.com → Pi-hole-DNS → blockiert (gibt 0.0.0.0 zurück) → keine Werbung

Alle DNS-Anfragen gehen zuerst durch Pi-hole.
Pi-hole prüft gegen Blocklisten.
Blockierte Domains erhalten eine Null-Antwort – die Werbung/der Tracker wird nie geladen.
Erlaubte Domains werden an deinen Upstream-Resolver weitergeleitet (Cloudflare, Google usw.).

Installation

Docker (Empfohlen)

Docker ist der einfachste Weg, Pi-hole zu installieren und macht Updates und Backups unkompliziert.

# docker-compose.yml
services:
  pihole:
    image: pihole/pihole:<pinned-release-tag>
    container_name: pihole
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "80:80/tcp"          # Web-Administration
    environment:
      TZ: "America/New_York"
      WEBPASSWORD: "${PIHOLE_WEBPASSWORD}"   # über .env-Datei oder Secret setzen
      PIHOLE_DNS_: "1.1.1.1;1.0.0.1"
      DNSMASQ_LISTENING: "all"
    volumes:
      - "./etc-pihole:/etc/pihole"
      - "./etc-dnsmasq.d:/etc/dnsmasq.d"
    restart: unless-stopped
    cap_add:
      - NET_ADMIN              # nur nötig, wenn Pi-hole DHCP bedient

Ersetze <pinned-release-tag> vor dem Deployment durch eine aktuelle Pi-hole-Release-Version. Vermeide latest für langlebige DNS-Infrastruktur, damit Upgrades bewusst und überprüfbar sind.

Setze PIHOLE_WEBPASSWORD in einer .env-Datei neben docker-compose.yml, chmod sie auf 600 und halte sie aus Git heraus – setze das Passwort nicht direkt in die Compose-Datei.

Web-Administration aufrufen unter: http://<pi-ip>/admin

Bare-Metal-Installation (Raspberry Pi OS / Debian / Ubuntu)

Pi-hole benötigt vor der Installation eine statische IP.

# Schritt 1: Statische IP zuweisen (bearbeite /etc/dhcpcd.conf auf Pi OS)
sudo nano /etc/dhcpcd.conf
# Füge am Ende hinzu:
interface eth0
static ip_address=192.168.3.2/24
static routers=192.168.3.1
static domain_name_servers=192.168.3.1

# Schritt 2: Installer herunterladen und vor der Ausführung prüfen.
# Bevorzuge den Paket- oder Installationspfad, der von Pi-hole für dein OS/deine Version dokumentiert wird.
curl -sSL https://install.pi-hole.net -o pi-hole-install.sh
less pi-hole-install.sh   # vor dem Fortfahren prüfen

# Schritt 3: Ausführen
bash pi-hole-install.sh

# Folge dem interaktiven Installer:
# 1. Netzwerkschnittstelle auswählen (eth0 für kabelgebunden – empfohlen)
# 2. Upstream-DNS auswählen (Cloudflare oder Standard belassen – kann später geändert werden)
# 3. Statische IP bestätigen
# 4. Web-Administrationsoberfläche installieren (empfohlen)
# 5. Das am Ende angezeigte Admin-Passwort notieren

Netzwerk auf Pi-hole ausrichten

# Methode 1: DNS in den Router-DHCP-Einstellungen ändern (empfohlen)
  Router-Admin-Oberfläche → DHCP-Einstellungen → DNS-Server
  Primär-DNS: 192.168.3.2  (Pi-hole-IP)
  Sekundär-DNS: für strikte Blockierung leer lassen, oder einen zweiten Pi-hole verwenden.
                 Ein öffentlicher Fallback wie 1.1.1.1 verbessert die Verfügbarkeit während
                 der Einführung, kann jedoch die Blockierung umgehen, da Clients ihn abfragen können.

  Alle Geräte erhalten Pi-hole automatisch als DNS bei der nächsten DHCP-Verlängerung.
  Erzwungene Verlängerung: WLAN neu verbinden oder unter Linux 'sudo dhclient -r && sudo dhclient' ausführen

# Methode 2: Gerätespezifisches DNS (nützlich zum Testen vor der netzwerkweiten Einführung)
  Windows: Systemsteuerung → Netzwerkadapter → IPv4-Eigenschaften → DNS manuell setzen
  macOS: Systemeinstellungen → Netzwerk → Details → DNS → manuell setzen
  Linux: /etc/resolv.conf oder NetworkManager

# Methode 3: Pi-hole als DHCP-Server (ersetzt Router-DHCP)
  Pi-hole-Administration → Einstellungen → DHCP → Aktivieren
  Deaktiviere zuerst das DHCP auf deinem Router – zwei DHCP-Server im selben Netzwerk verursachen Konflikte
  Vorteil: Hostnamen-Auflösung funktioniert automatisch (Geräte registrieren ihre Namen)

Blocklisten-Verwaltung

# Pi-hole-Administration → Adlisten → Neue Adliste hinzufügen

# Empfohlene Blocklisten:
  https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
  # Standard – 200k+ Domains

  https://blocklistproject.github.io/Lists/malware.txt
  # Malware-Domains

  https://blocklistproject.github.io/Lists/tracking.txt
  # Tracking/Telemetrie

# Nach Hinzufügen einer Liste:
  Tools → Gravity aktualisieren  (lädt alle Blocklisten herunter und kompiliert sie)

# Wenn eine Seite blockiert wird, die nicht blockiert werden sollte (falsch positiv):
  Pi-hole-Administration → Whitelist → Domain hinzufügen
  Beispiel: api.my-legitimate-service.com

# Prüfen, was in Echtzeit blockiert wird:
  Dashboard → Abfrageprotokoll  (Live-DNS-Abfragestream mit Block/Erlauben-Status)

DNS-over-HTTPS Upstream

DNS-over-HTTPS verschlüsselt deine DNS-Abfragen, sodass dein ISP nicht sehen kann, welche Seiten du auflöst.

# Cloudflared installieren (Cloudflares DoH-Proxy).
# Bevorzuge Cloudflares Paket-Repository für automatische signierte Paketüberprüfung.
# Wenn du ein Binary direkt herunterlädst, pinne eine Release-Version und überprüfe seinen Prüfsumme.
CLOUDFLARED_VERSION="<pinned-version>"
curl -LO "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-arm64"
# Überprüfe die Prüfsumme/Signatur aus Cloudflares Release-Notizen, bevor du installierst.
sudo mv cloudflared-linux-arm64 /usr/local/bin/cloudflared
sudo chmod +x /usr/local/bin/cloudflared

# Cloudflared-Konfiguration erstellen
sudo mkdir -p /etc/cloudflared
sudo tee /etc/cloudflared/config.yml << EOF
proxy-dns: true
proxy-dns-port: 5053
proxy-dns-upstream:
  - https://1.1.1.1/dns-query
  - https://1.0.0.1/dns-query
EOF

# Systemd-Dienst erstellen
sudo cloudflared service install
sudo systemctl start cloudflared
sudo systemctl enable cloudflared

# Jetzt Pi-hole auf den lokalen DoH-Proxy ausrichten:
# Pi-hole-Administration → Einstellungen → DNS → Benutzerdefinierter Upstream-DNS
# Setze auf: 127.0.0.1#5053
# Deaktiviere alle anderen Upstream-Resolver

Lokale DNS-Einträge

Mache deine Dienste über Namen erreichbar (z.B. nas.home.lan, grafana.home.lan).

Hinweis zum Domainnamen: .home.lan wird in Homelabs häufig verwendet und funktioniert in der Praxis. Das von der IETF reservierte Suffix für lokale Nutzung ist .home.arpa (RFC 8375) – verwende dies, um dem Standard zu folgen. Vermeide .local für Pi-hole-DNS-Einträge, da es mit mDNS/Bonjour kollidiert.

# Pi-hole-Administration → Lokales DNS → DNS-Einträge

  Domain              IP
  nas.home.lan        192.168.30.10
  pi.home.lan         192.168.30.2
  grafana.home.lan    192.168.30.3
  proxmox.home.lan    192.168.30.4

# Von jedem Gerät in deinem Netzwerk:
  ping nas.home.lan        → 192.168.30.10
  http://grafana.home.lan  → dein Grafana-Dashboard

# Für Subdomains einen CNAME hinzufügen:
  Pi-hole-Administration → Lokales DNS → CNAME-Einträge
  Domain: portainer.home.lan → Ziel: pi.home.lan

Fehlerbehebung

# Pi-hole blockiert etwas, das es nicht sollte
pihole -q example.com          # Prüfen, ob die Domain blockiert ist und von welcher Liste
pihole -w example.com          # Sofort whitelisten

# DNS löst überhaupt nicht auf
pihole status                  # Prüfen, ob pihole-FTL läuft
dig @192.168.3.2 google.com   # DNS direkt gegen Pi-hole testen

# Pi-hole-DNS neu starten
pihole restartdns

# Abfrageprotokolle für ein bestimmtes Gerät prüfen
pihole -t                      # Live-Ansicht aller Abfragen
# Oder nach Client im Web-Admin-Abfrageprotokoll filtern

# Pi-hole-Gravity aktualisieren (Blocklisten auffrischen)
pihole -g

Anti-Patterns

# SCHLECHT: Von einem einzelnen Pi-hole ohne Wiederherstellungspfad abhängig sein
# Wenn Pi-hole abstürzt oder der Pi die Stromversorgung verliert, kann DNS ausfallen
# GUT: Während der Einrichtung einen dokumentierten Router-Fallback für Rollback bereithalten
# BESSER: Zwei Pi-hole-Instanzen für Redundanz betreiben; öffentlichen Fallback-DNS für strikte Blockierung vermeiden

# SCHLECHT: Pi-hole ohne statische IP installieren
# Wenn der Pi eine neue DHCP-IP erhält, verlieren alle Geräte DNS
# GUT: Zuerst statische IP setzen, dann Pi-hole installieren

# SCHLECHT: Pi-hole-DHCP aktivieren, ohne zuerst das Router-DHCP zu deaktivieren
# Zwei DHCP-Server im selben Netzwerk verteilen widersprüchliche IPs
# GUT: Router-DHCP deaktivieren, dann Pi-hole-DHCP aktivieren

# SCHLECHT: Gravity (Blocklisten) nie aktualisieren
# Neue Werbe- und Malware-Domains sammeln sich an – veraltete Listen verpassen sie
# GUT: Wöchentliches Gravity-Update planen: pihole -g (oder in Einstellungen → API aktivieren)

Best Practices

  • Gib dem Pi vor der Pi-hole-Installation eine statische IP oder DHCP-Reservierung
  • Verwende Pi-hole als primären DNS; für Redundanz einen zweiten Pi-hole hinzufügen, anstatt einen öffentlichen Resolver, wenn du strikte Blockierung benötigst
  • Aktiviere DoH (DNS-over-HTTPS) mit cloudflared für verschlüsselte Upstream-Abfragen
  • Setze home.lan als deine lokale Domain und erstelle DNS-Einträge für alle deine Dienste
  • Überprüfe gelegentlich das Abfrageprotokoll – blockierte Abfragen zeigen dir, was die Geräte tun

Verwandte Fähigkeiten

  • homelab-network-setup
  • homelab-vlan-segmentation
  • homelab-wireguard-vpn

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

Verwandte Skills