Hallo zusammen,
ich habe auf Ubuntu 20.04 LTS Docker installiert und PiHole im Container laufen. Das funktioniert im Prinzip auch, aber nur, wenn ich nach jedem Neustart folgende Befehle ausführe (s. https://github.com/pi-hole/docker-pi-hole#installing-on-ubuntu):
sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf' systemctl restart systemd-resolved
Wenn ich diese Befehle ausführe, meldet mir
cat /etc/resolv.conf
folgendes:
# This file is managed by man:systemd-resolved(8). Do not edit. # # This is a dynamic resolv.conf file for connecting local clients directly to # all known uplink DNS servers. This file lists all configured search domains. # # Third party programs must not access this file directly, but only through the # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way, # replace this symlink by a static file or a different symlink. # # See man:systemd-resolved.service(8) for details about the supported modes of # operation for /etc/resolv.conf. nameserver 172.20.20.10 nameserver 192.168.178.1
Das sind die beiden DNS-Server, die per DHCP zugeteilt werden. Also alles korrekt.
Ohne die zuvor genannten Befehle bekomme ich stattdessen die Meldung:
cat: /etc/resolv.conf: Datei oder Verzeichnis nicht gefunden
Die Datei /etc/systemd/resolved.conf hat folgenden Inhalt
This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See resolved.conf(5) for details [Resolve] #DNS= #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no #DNSOverTLS=no #Cache=no-negative DNSStubListener=no #ReadEtcHosts=yes
DNSStubListener=no musste ich ändern, weil sonst port 53 blockiert ist und pihole dann nicht startet.
Ich möchte natürlich erreichen, dass die Datei resolv.conf bei jedem Systemstart gleich mit dem richtigen Inhalt erzeugt wird. Was muss ich dafür tun?
Herzlichen Dank!