I have Pi-hole installed on Raspbian 11. My /etc/resolv.conf has a nameserver entry pointing to itself for DNS resolution. When Pi-hole hangs or is stopped, all DNS resolution on that system fails.
I would like to add a secondary DNS server to only that system, but I do not have a /etc/resolvconf/resolv.conf.d directory and adding head or tail files here and rebooting does nothing.
The Pi gets its IP and DNS server (itself) from DHCP. So far, I have managed to achieve what I need by changing my /etc/resolvconf.conf file and setting name_servers= to the entries I need.
I'm confused how all this fits together despite reading a hundred posts about resolv, dnsmasq, dhcpcd.conf and everything else. Shouldn't adding head / tail files to the system to append DNS servers work?
NetworkManager (NM) is most likely populating resolv.conf:
pi@ph5b:~ $ apt show network-manager
[..]
Description: network management framework (daemon and userspace tools)
NetworkManager is a system network service that manages your network devices
and connections, attempting to keep active network connectivity when
available. It manages ethernet, Wi-Fi, mobile broadband (WWAN), and PPPoE
devices, and provides VPN integration with a variety of different VPN
services.
.
This package provides the userspace daemons and a command line interface to
interact with NetworkManager.
.
Optional dependencies:
* ppp: Required for establishing dial-up connections (e.g. via GSM).
* dnsmasq-base/iptables: Required for creating Ad-hoc connections and
connection sharing.
* libteam-utils: Network Team driver allows multiple network interfaces to be
teamed together and act like a single one. This process is called "ethernet
bonding", "channel teaming" or "link aggregation".
You can check which connection name is active with below:
nmcli connection show --active
And see how NM is configured for that connection name with below:
NM most likely configured 127.0.0.1 in resolv.conf bc its expecting a stub resolver to answer on that address (for caching).
These are all distro specific related settings.
You should consult documentation for your distro for this!