0

I know that DNS treats domain names as a system of pointers, where you follow a path of domains from more general (e.g. .com.) to more specific (e.g. www.example.com.) in order to locate a host, but it is an outside means of addressing of which the host may or may not be aware.
We are also free to change the host's domain name in DNS as often as we want, or have several different names for a single host (e.g. www.example.com. and sip.example.com.) which isn't something that's local FQDN is fit for.

If you join an Active Directory domain, then it makes sense for a host to acquire the same domain name, but even non-members of IPA or AD sometimes are required to have their FQDN set by certain software packages.

So why would a Linux host need to have a notion of its own "domain name"?
At what point is it used by the OS and its network neighbors in practice?

1 Answer 1

1

It's added into /etc/resolv.conf and used by literally everything that has cause to do a DNS lookup.

As per the resolv.conf manpage:

search Search list for host-name lookup.

By default, the search list contains one entry, the local domain name. It is determined from the local hostname returned by gethostname(2); the local domain name is taken to be everything after the first '.'. Finally, if the hostname does not contain a '.', the root domain is assumed as the local domain name.

This may be changed by listing the desired domain search path following the search keyword with spaces or tabs separating the names. Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using each component of the search path in turn until a match is found. For environments with multiple subdomains please read options ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains.

What this boils down to is that if, say, you're on the private network company.local you can type ping mail and it will attempt to look up mail.company.local (which is likely the one you were looking for).

1
  • 1
    It is also heavily used in mail setup. The MTA will use that domain in it's greeting message, in HELO/EHLO messages that it will present to other mail servers, and as the default domain part in sender's address, if the domain is not specified explicitly in the message (so called "address canonicalization"). For example if the sender in "From:" header is just john, it will be changed to [email protected]. Also, in default configuration MTA will know that it has to accept mails for this domain and deliver them locally, and not search for MX for that domain.
    – raj
    Sep 13, 2021 at 15:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .