After upgrading my KVM VPSes to 22.10 they can no longer resolve addresses. Same issue on all the servers hosted on the same provider (I used their image to install 22.04). I had other 22.04 instances (hosted on another provider) that I upgraded at the same time to version 22.10 and they don't show this problem.
$ sudo ping google.com
ping: google.com: Temporary failure in name resolution
$ resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (eth0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 3 (docker0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
$ ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 37 Dec 6 19:50 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
$ sudo service systemd-resolved status
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
Active: active (running) since Tue 2022-12-06 19:51:52 CET; 42min ago
Docs: man:systemd-resolved.service(8)
man:org.freedesktop.resolve1(5)
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 451 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 9168)
Memory: 5.6M
CPU: 197ms
CGroup: /system.slice/systemd-resolved.service
└─451 /lib/systemd/systemd-resolved
Dec 06 19:51:52 wh1 systemd[1]: Starting Network Name Resolution...
Dec 06 19:51:52 wh1 systemd-resolved[451]: Positive Trust Anchors:
Dec 06 19:51:52 wh1 systemd-resolved[451]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Dec 06 19:51:52 wh1 systemd-resolved[451]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.ar>
Dec 06 19:51:52 wh1 systemd-resolved[451]: Using system hostname 'wh1'.
Dec 06 19:51:52 wh1 systemd[1]: Started Network Name Resolution.
$ cat /etc/resolv.conf
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically 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 127.0.0.53
options edns0 trust-ad
search .
Manually entering nameserver 1.1.1.1
in /etc/resolv.conf
temporarily fixes the problem, until the next reboot, when the file is reset. Before the upgrade, with version 22.04, the servers were working properly.
This is instead the output for my working 22.10 instances, where in fact DNS servers are listed:
$ resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=allow-downgrade/supported
resolv.conf mode: stub
Current DNS Server: 46.38.252.230
DNS Servers: 46.38.252.230 46.38.225.230 2a03:4000:0:1::e1e6 2a03:4000:8000::fce6
Link 2 (eth0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=allow-downgrade/supported
Link 27 (docker0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=allow-downgrade/supported
I found several similar posts, but none solved my problem.
EDIT: I just found out that on servers where DNS resolving does not work, netplan
is not installed, while it is installed on the working servers. I don't really know how networking works in Ubuntu, but maybe this could be the culprit. How do I fix it?
I managed to fix it by following this short guide here (plus a little bit of intuition): https://gist.github.com/mss/7a8e048dd51e5ef928039f1450ba8f31
Migrate from ifupdown to netplan.
# Tested on an upgraded Ubuntu 20.04
apt install netplan.io
systemctl unmask systemd-networkd.service
systemctl unmask systemd-resolved.service
ENABLE_TEST_COMMANDS=1 netplan migrate
netplan try
reboot
apt purge ifupdown resolvconf
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments