Is this naming scheme correct?
Are there official definitions of these?
The term, and command, 'hostname' in GNU/Linux is quite different from what I'll say below about what a hostname is.
In GNU/Linux a hostname is both a machine name and a network name in one. In other words it can be either a single label, or a set of labels connected by dots. It's used together with /etc/hosts for things like ssh.
But if you want to run a web server, it's not used, rather Apache is effectively pointed to by a DNS record, and then your Apache setup figures out which domain name you're serving.
BTW, the nearest thing to a GNU/Linux machine name (that is not a hostname) comes from `hostnamectl --pretty'.
1) hostname defined
The term 'hostname' dates back to 1985 or before, and so this term predates the DNS (the Domain Name Server) which comes later in 1987.
Initially there was one big text file of
hostnames, which had a name column, and an IP address column, allowing one to lookup a name and find the associated IP address to the physical machine for that name.
As near as I can tell, there is no RFC which explicitly says hostnames are domain names (see note from WikiPedia below that says this is true, but without a reference).
But if you think about it, the DNS had to replace the simple text list. In other words, it had to do the lookup from name to IP, so I think the old hostname then became a domain name when DNS was created.
For clarity, today a machine name is NOT a domain name. While they might be the same or similar, they are not directly related, except that at first they were roughly the same thing back then. See Choosing a Name for Your Computer
Avoid domain names.
For technical reasons, domain names should be avoided. In
particular, name resolution of non-absolute hostnames is
problematic. Resolvers will check names against domains before
checking them against hostnames. But we have seen instances of
mailers that refuse to treat single token names as domains.
For example, assume that you mail to "libes@rutgers" from
yale.edu. Depending upon the implementation, the mail may go
to rutgers.edu or rutgers.yale.edu (assuming both exist).
2) domain names defined
The internet was conceptualized with RFCs (Request for Comment documents), so the terminology is abstract not concrete. For example,
host are abstractions, while machine and computer are concrete things.
Before proceeding, I found that a review 'Tree Terminology' for the abstract definition for tree, leaf, and node helped get me get more solid footing.
Official RFC definitions:
rfc1034, section 3.1 defines
domain name space,
subdomain [emphasis below mine]:
The domain name space is a tree structure. Each node and leaf on the
tree corresponds to a resource set (which may be empty). The domain
system makes no distinctions between the uses of the interior
nodes and leaves, and this memo [RFC] uses the term "node" to
refer to both.
Each node has a label, which is zero to 63 octets in length. Brother nodes [sibblings]
may not have the same label [in other words they need to be unique], although the same label can be used
for nodes which are not brothers. One label is reserved, and that is
the null (i.e., zero length) label used for the root.
[THIS IS IMPORTANT>] The domain name of a node is the list of the labels on the path from the node to the root of the tree.
When a user needs to type a domain name, the length of each label
is omitted and the labels are separated by dots ("."). Since a
complete domain name ends with the root label, this leads to a printed
form which ends in a dot. We use this property to distinguish
a character string which represents a complete domain name
(often called "absolute"). For example, "poneria.ISI.EDU." [<-- note the trailing dot]
a character string that represents the starting labels of a
domain name which is incomplete, and should be completed by
local software using knowledge of the local domain (often
called "relative"). For example, "poneria" used in the
Relative names are either taken relative to a well known origin, or to
a list of domains used as a search list. Relative names appear mostly
at the user interface, where their interpretation varies from
implementation to implementation, and in master files, where they are
relative to a single origin domain name.
[THIS IS ALSO IMPORTANT>] A domain is identified by a domain name, and consists of that part of
the domain name space that is at or below the domain name which
specifies the domain. A domain is a subdomain of another domain if it
is contained within that domain. This relationship can be tested by
seeing if the subdomain's name ends with the containing domain's name.
For example, A.B.C.D is a subdomain of B.C.D, C.D, D, and " ".
Finally, Wikipedia says:
A hostname is a domain name which has an associated DNS
record. When the domain name is looked up (resolved) the resolver
returns the IP address of the physical machine which is suppose to
respond to requests to that domain. Like for example, there might be
a type A DNS record for a given domain name, which returns "a
[physical] host address", i.e. an IP address. A web server
running on a machine hooked to the internet on that static IP address
might then serve web pages when that domain name is used in a URL.
"Hosts that have multiple Internet addresses will have multiple A records." So one physical computer can serve, for example, web pages for one or more domains.