As far as I know, A fully qualified domain name (FQDN) consists of two parts:

  1. The hostname part: A single label representing a machine belonging to one specific domain.

  2. The domain name part: Multiple labels joined with dots and representing the domain, which is basically a group of machines.

Normally, only with a FQDN can we visit a particular machine on a particular network from outside. We can't do it with only either the hostname part or the domain name part.

For example, the www.google.com FQDN specifies the hostname part as www and the domain name part as google.com. And with this FQDN we can visit a machine in the google.com domain.

It all looked nice until I came across a FQDN which also functioned as a domain name in an experimental environment manually set by others. Here is the procedure I have went through :

  1. I opened Wireshark and started capturing packets.

  2. I visited cool.com using my browser.

  3. The web page was successfully loaded. And Wireshark captured something. It showed that when my local DNS server asked upper level domain name servers the IP address of the cool.com server, it was led to the authoritative name server of the cool.com domain, which was ns.cool.com. And this authoritative name server replied with the IP address of the cool.com server.

    The authoritative name server was shown in a NS type resource record with key cool.com returned by some upper level domain name server. And the IP address of the cool.com server was shown in an A type resource record with key cool.com returned by the authoritative name server, i.e., by ns.cool.com.

    Examining the headers of the HTTP request sent to cool.com later, I made sure my browser was not playing tricks like automatically extending cool.com to www.cool.com. So I was actually paying a visit to cool.com.

My question is, why the cool.com domain name can itself be a FQDN in this case? I hadn't defined the hostname part yet. The boundary between a FQDN and its domain name part seems blur...

Is it up to the network administrator which machine I would end up visiting or something? Thank you so much if anyone gives me an explanation!


Solution 1:

FQDN doesn't consist of only two parts. It consists of multiple (or even single) labels but should include TLD. In your case www.cool.com, cool.com and com are all domain names (3rd-level domain, 2nd-level domain and top-level-domain AKA TLD) and FQDNs.

The leftmost part of a domain name (www) is a leaf domain, hostname, local part, host part.

At the same time, a hostname isn't defined as a single label. A hostname can be any domain name.

A hostname can be specified as a single label relative to some domain (e.g. host). It can be specified as multiple labels and still relative to some domain (e.g. host.internal-sub-domain). It can be specified with all labels up to TLD and in this case, it is called FQDN (fully-qualified domain name), e.g. host.internal-sub-domain.second-level-domain.tld.

You can access any domain name/hostname with a browser as long as it has an A record and responds to HTTP/HTTPS. There are even some TLDs with A records assigned (eg http://ai/)