Pi-Hole mit DNS over HTTPS nutzen

Wer seine DNS-Abfragen verschlüsseln möchte und damit sorgen möchte, das keiner mehr die Anfragen mitlesen kann, kann DNS-over-HTTPS nutzen.
Wie du das ganze zusammen mit deinem Pi-Hole nutzen kannst, zeige ich dir hier!

Was sind die Vorteile?
– Abfragen sind komplett verschlüsselt und können nicht mehr mitgelesen werden
– Die Abfragen sind ab deinem Pi-Hole wieder unverschlüsselt, um Werbung, Tracker & Co. blocken zu können

Nachteile?
– Es gibt nur wenige DNS-Resolver die das Anbieten
– Abfragen können das erste mal etwas länger brauchen

Wie du das ganze installieren kannst, zeige ich hier im Video:




Alles in Textform gibt es natürlich auch.
Hier sind die Befehle, die du brauchst.

Als erstes besorgen wir uns das Tool Cloudflared.
Für Debian / Ubuntu sind folgende Befehle zu verwenden:

# wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
# apt-get install ./cloudflared-stable-linux-amd64.deb
# cloudflared -v

Bei CentOS / RHEL / Fedora sieht es wie folgt aus:

# wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.rpm
# yum install ./cloudflared-stable-linux-amd64.rpm
# cloudflared -v

Bei einem ARM-Prozessor wie z.B. bei einem Raspberry Pi, bekommst du CloudFlared wie folgt:

# wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
# tar -xvzf cloudflared-stable-linux-arm.tgz
# cp ./cloudflared /usr/local/bin
# chmod +x /usr/local/bin/cloudflared
# cloudflared -v

Wir legen nun einen Konfigurationsordner an und erstellen darin eine neue Konfiguration.

# mkdir /etc/cloudflared/
# nano /etc/cloudflared/config.yml

Füge in die Datei nun folgenden Inhalt ein:

proxy-dns: true
proxy-dns-port: 5053
proxy-dns-upstream:
  - https://1.1.1.1/dns-query
  - https://1.0.0.1/dns-query

Du kannst ab Zeile 4 auch andere Upstream-Server eintragen.
Weitere Vorschläge zu Upstream-Server gibts am Ende dieser Anleitung.
Füge einfach weitere Zeilen darunter ein, um weitere Server hinzuzufügen.

Nun lassen wir CloudFlared als Service installieren.

# cloudflared service install

Jetzt muss es nur noch gestartet werden und gleichzeitig können wir teste, ob alles läuft.

# systemctl start cloudflared
# systemctl status cloudflared

Soweit alles passt, können wir einmal eine Abfrage starten.

# dig @127.0.0.1 -p 5053 hoerli.net

Es sollte funktionieren.

Damit wir nun unser Pi-Hole auch verwenden können, müssen wir CloudFlared als Upstream-Server hinterlegen.
Trage also im Feld Custom 1 die lokale IP des Pi-Holes ein und entferne jeden anderen Upstream-Server.

Wir sind fertig!


Wer noch mehr Infos dazu braucht, für den habe ich hier ein paar gute Links gesammelt.
Die Anleitung in der Pi-Hole-Doku: https://docs.pi-hole.net/guides/dns-over-https/
Eine Liste mit DoH-Servern: https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Public+Resolvers
Eine weitere Sammlung an DoH-Servern: https://www.privacytools.io/providers/dns/
Das Privacy-Handbuch inkl. Anleitung für Firefox mit DoH-Empfehlungen: https://www.privacy-handbuch.de/handbuch_21w.htm

9 Kommentare

  1. Thank you for your great tutorial. I have a couple of questions about it.

    1) Missing listen_address is this not matter?
    1)can I use https://1.1.1.3/dns-query and https://1.0.0.3/dns-query Instead https://1.1.1.1/dns-query and https://1.0.0.1/dns-query

    • 1) No, no idea where you want to embed this. This parameter is not necessary.
      2) Yes, you can include all HTTPS-enabled DNS servers. You do not have to use CloudFlare.

  2. Thank you for your quick response. https://1.1.1.3/dns-query and https://1.0.0.3/dns-query are Cloudflare DNS which are used for parental control and malware. How do I know my DNS is encrypted?

    Thank You for your help and support.

    • You can test it by blocking all traffic for port 53 in your firewall or by listening to your clients with tools like Wireshark.
      In the log you should also find the connections that are called.

      By the way: The protection functions of CloudFlare are very poor. Any virus scanner is better than that. If you prefer to surf with a little sense and reason, then you are safe on the road.

  3. Thank you so much for your instruction and advice. Please advise me on the best DNS protection and functions. I’m using Dietpi and install Adguard home on it. Working well so far but not sure how safe is it? Some say it is Russian who can have your data. I know it is open sources but all open sources are not safe.
    Adguard Home or Use Pi-Hole with DNS over HTTPS?

    • If you don’t want to give data to anyone just like that, pi-hole should clearly be preferred.
      AdGuard is nice, but you do not have full control over it.
      With Pi-Hole you can also set your own filters and select the upstream servers. You can’t do that directly with AdGuard, and you can’t do it as fine.
      If you already have a Raspberry Pi, use it as a pi-hole.

  4. Maybe I’m wrong but it runs over any Linux or Unix system. I can explain how I did, I install Raspberry Pi, Updated, and upgrade the latest version. Use this command

    cd $HOME
    wget https://static.adguard.com/adguardhome/release/AdGuardHome_linux_arm.tar.gz
    tar xvf AdGuardHome_linux_arm.tar.gz
    It will unpack into a new directory called AdGuardHome.

    All you have to do is simply type this command to the Terminal:

    cd AdGuardHome
    sudo ./AdGuardHome -s install

    https://adguard.com/en/privacy/home.html

    https://github.com/AdguardTeam/AdGuardHome/wiki/Raspberry-Pi

    I have full control like Pi. Thank you

  5. Hello sir,
    If you don’t mind can you please make a tutorial about using nextdns. They said it will support the following on the
    Stubby
    DNSCrypt
    Knot Resolver
    cloudflared
    systemd-resolved
    Unbound
    Thank you so much and appreciate your help.

  6. No more works after the (Now let’s install CloudFlared as a service.) Need updated tutorials. Argo: “Error – Certificate signed by unknown authority”.
    ERRO[0026] HTTP request error error=”Error proxying request to origin: x509: certificate signed by unknown authority”
    cloudflared does not support loading the system root certificate pool on Windows. Please use the –origin-ca-pool to specify it

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.