There are many (IMHO, too many) places to configure the DNS server(s) used and I am not sure about the relationship between them. A few questions are: Which configurations are only queried conditionally (For example, if I understand correctly, the systemd configuration is not queried if the corresponding service is not running)? Which configurations override which? What is the recommended way to configure DNS?
To name a few places to configure the DNS server(along with some other information I know about them, which should kindly be corrected if there is any misunderstanding),
- Write in
chattrto force it to remain persistent after reboot (I think this one is discouraged)
resolvconf. Config in the various files in
resolvconf -ato add a DNS and
resolvconf -uto update it
systemd-resolve(d), a unit of
systemd. Config in
/etc/systemd/resolvd.conf. It uses the address
127.0.0.53as the dummy DNS solver in
/etc/resolv.conf. The real
resolv.confis found in
/var/run/systemd/resolve/resolv.conf. In newer versions (since which version?),
systemd-resolve --statuscan be used to query the current DNS status.
/etc/network/interfaces. This one is related to
Network-Manager, a component that drives the network configuration context menu in GUI. If an interface is configured in
/etc/network/interfaces, it will refuse to manage it again (shown as
not managedin the GUI context menu).
I am running
Ubuntu 18.04 LTS with Unity desktop environment.