I've been using Ubuntu Server 21.10 for about 6 months without incident. Recently I've had some services (both in containers, and the Docker daemon itself) suddenly experience issues due to DNS resolution failing.
yoshie@vdocker:~$ systemd-resolve --status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: missing
Link 2 (enp0s4)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Servers: 8.8.8.8 8.8.4.4
DNS Domain: localdomain
yoshie@vdocker:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=11.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=10.7 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
yoshie@vdocker:~$ ping google.com
ping: google.com: Temporary failure in name resolution
I can see that /etc/resolv.conf is indeed missing. But looking online, it appears that it's not recommended to write this file myself. According to this site, the file could be written by resolvconf, network-manager, or a DHCP client.
I don't have resolvconf or network-manager installed:
yoshie@vdocker:~$ resolvconf
Command 'resolvconf' not found, but can be installed with:
sudo apt install openresolv # version 3.12.0-1, or
sudo apt install resolvconf # version 1.84ubuntu1
yoshie@vdocker:~$ sudo service network-manager status
Unit network-manager.service could not be found.
I do have DHCP enabled, but my DHCP server is configured with 8.8.8.8 and 8.8.4.4, which I think is where systemd-resolve --status is getting the DNS addresses from. But resolution is still failing.
I tried specifying the DNS servers within my netplan config, but doing so made my server unreachable and I had to undo the change via a console session.
I started following these instructions for configuring DNS with systemd-resolved, but it seemed like some of the directories I needed did not exist and I abandoned the process as I suspect it's not appropriate for Ubuntu.
I have tried rebooting the server, but to no avail.
In a vanilla Ubuntu 21.10 install, what's the expected mechanism for DNS resolution to work? What process should write resolv.conf? Why might DNS resolution suddenly be failing when it has always worked in the past?