2

I'm trying to understand the difference between a subdomain and a domain in a LAN versus a WAN (Internet). (Or am I just fooling myself. Is it the same?)

If I google it I just get that a subdomain is the beginning like x.domain.com where x is the subdomain. In the real world you just put an A-record (in the DNS) to the x.domain.com where you refere the subdomain to an IP-adress. That's not strange at all. You just refer to a specific computer (where the webbserver hopefully is)

But if you like a say in a LAN then you have domain with a domain and a subdomain that is a part of the parent domain. I understood that a subdomain could be like computers or network resources that are part of the parent domain but that does not makes sense to me in an URL because that URL just points to one computer. O

Is a subdomain essentially just a host? (Isn't FQDN and subdomain the same thing then?)

2 Answers2

5

A domain is essentially an entry in the DNS database (e.g. ., net., example.com.). A subdomain is a domain with an additional label (e.g. org., example.net., www.example.com.).

On top of this people add some semantics. So:

  1. A subdomain may indicate different services offered by an organization: e.g. example.com may offer www.example.com, smtp.example.com, imap.example.com. These should be read as www service of example.com, smtp service of example.com, imap service of example.com. That is the sense of subdomain in the authority part of an URL.
  2. A subdomain may also indicate a physical host (or better an instance of an operating system or one of its network interfaces): web1.example.com, master.example.com, etc.

For usage 1. SRV records were introduced (or similar, like MX), except the www service that monopolized A records and will never let them go.

A FQDN is just an absolute DNS name: web1.example.com. Internally in an organization hosts and services are referenced just by their last label (web1).

Piotr P. Karwasz
  • 5,748
  • 2
  • 11
  • 21
  • Based on your answer (2) the answer of my question is yes :-) Or actually what you're saying is: "A subdomain is either a host or a service" ? "Internally in an organization hosts and services are referenced just by their last label (web1)" Yes true, but only if NetBIOS is active? – bestprogrammerintheworld Mar 10 '20 at 20:24
  • NetBIOS is a different name resolution system that is not DNS. While it has shorter length limits and no hierarchical structure, those are reasons why it is legacy and should not be used. – John Mahowald Mar 10 '20 at 20:41
  • 1
    The local resolver on Linux machines appends the domain name to queries for single labels (depends on the resolver), so subdomains can be accessed through a single label like `web1`. – Piotr P. Karwasz Mar 10 '20 at 20:44
  • Ok thanks for the clarification! – bestprogrammerintheworld Mar 11 '20 at 20:02
3

DNS is a database organized as a tree. A subdomain is a name contained within a parent name, for example meta.serverfault.com. is a subdomain of serverfault.com..

A fully qualified domain name includes the top level domain and the (zero length) root. So, www.example.com. is a FQDN. Often it is convenient to have DNS resolvers search the local domain. So www becomes a shortcut to www.example.com. on Example Corp's LAN. While technically FDQNs can be any name, playing nice with the rest of the Internet means registering a name with a well-known TLD.

DNS domain names are not hosts, even if it makes a lot of sense to have a name in DNS for every host. They are keys in a hierarchical database system. Arbitrary data can be associated with domain in a variety of data types. For example, TXT records are used for SPF, DMARC, and ACME DNS challenges.

Even IP address records don't necessarily map to one computer, nor does one IP address only appear as one name. meta.serverfault.com. and serverfault.com. have A records with the same IP address. Other non-DNS components (load balancers, HTTP name based virtual hosts) route to the web site in question.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34