After upgrading a server from Ubuntu 20.04 to 22.04, the DNS name resolution does not work anymore. ping 8.8.8.8
works but ping google.com
returns ping: google.com: Name or service not known
. Also wget does not work and sudo apt update
cannot resolve:
~$ sudo apt update
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Could not resolve 'de.archive.ubuntu.com'
Err:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Could not resolve 'security.ubuntu.com'
Err:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Could not resolve 'de.archive.ubuntu.com'
Err:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Could not resolve 'de.archive.ubuntu.com'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy/InRelease Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
I tried to use 8.8.8.8
as nameserver in /etc/resolv.conf
. In this case, ping google.com
returns ping: google.com: Temporary failure in name resolution
.
Only if I run sudo dhclient eth0
, everything works fine. However, only until the next reboot of the machine.
Here is some more information about the system, probably it may be helpful:
~$ ls -la /etc/resolv.conf
-rwxrwxrwx 1 root root 340 Jan 27 21:08 /etc/resolv.conf
~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search DOMAINS
~$ resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign
DNS Domain: DOMAINS
Link 2 (eth0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 3 (eth1)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 4 (docker0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
~$ sudo service systemd-resolved status
○ systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
Active: inactive (dead)
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
~$ sudo ufw status
Status: inactive
Any thoughts how this can be fixed? I have been trying for hours without success.