No DNS In Debian 11
If you see this content for "/etc/resolv.conf" you may need to setup a DNS server for your Debian server.
This file is managed by man:systemd-resolved(8). Do not edit.
This is a dynamic resolv.conf file for connecting local clients directly to
all known uplink DNS servers. This file lists all configured search domains.
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.
No DNS servers known.
The above means there is no DNS setup. But you also cannot directly edit "/etc/resolv.conf" because the file is auto generated and will be overridden next time your machine is restarted.
The above will also lead to "Unable to locate package" error when trying to run apt comments.
Trying to ping google or some other website will lead to a "ping: google.com: Temporary failure in name resolution" error.
All of these are DNS errors. Your Debian system needs to find a DNS name server to use.
The way to fix this DNS error in Debian 11 is to update your "/etc/systemd/resolved.conf" file and then run "sudo systemctl restart systemd-resolved" to restart the DNS. After that, DNS should resolve correctly.
The above is a simple fix for DNS not resolving on Debian 11, but knowing which file to update is tricky.