How shall I understand the format of `/etc/resolv.conf`

dnsresolv.conf

How shall I understand the format of /etc/resolv.conf?

$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# 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 "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must 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
search fios-router.home

Manpage of /etc/resolve.conf says

The different configuration options are:

   nameserver Name server IP address

          Internet address of a name server that the resolver should
          query...

So does nameserver 127.0.0.53 mean that my local machine is running a DNS server whose IP address is 127.0.0.53? How can I find out its process?

   domain Local domain name.

          Most queries for names within this domain can use short names
          relative to the local domain.  If set to '.', the root domain
          is considered.  If no domain entry is present, the domain is
          determined from the local hostname returned by gethostname(2);
          the domain part is taken to be everything after the first '.'.
          Finally, if the hostname does not contain a domain part, the
          root domain is assumed.

What does this part mean? The above just mentions what values that can be set to something, and does not explain what this part in /etc/resolv.conf means. Why does my /etc/resolv.conf not have this part?

   search Search list for host-name lookup.

          The search list is normally determined from the local domain
          name; by default, it contains only the local domain name.

What does this part mean? What does search fios-router.home in my /etc/resolv.conf mean?

Thanks.

Best Answer

/etc/resolve.conf is the main configuration file for the DNS client, so its presence does not imply that you are running a DNS server.

Its primary purpose is to list the IP addresses of DNS servers, in your case:

nameserver 127.0.0.53

  • Entries of type nameserver tell the host, which DNS server to use.
  • An entry of type domain (if present) tells the system which domain it is in. This allows to be addressed by its host name. (Addition in response to a comment: The hostname is the computer's name in the network. On many systems, you can see the hostname in the command prompt; if not, you can find it by using the command hostname.)
  • An entry of type search (if present) would allow computers from different domains to address each other by their respective host names.

The file is nowadays usually generated by NetworkManager (for example, on my system, the file starts with the comment "Generated by NetworkManager") or by systemd-resolved.

systemd-resolved

is a system service that provides network name resolution to local applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR and MulticastDNS resolver and responder.

Also according to systemd-resolved's manpage, the address 127.0.0.53 is a "local DNS stub listener". On related Stack Exchange sites, there have been questions about how to change this, since the file is /etc/resolv.conf is automatically generated. See for example

Related Question