HACKER Q&A
📣 aguayjabon

Is abc.domain.tld. a sub-domain of domain.tld?


Assuming "abc" is an A or CNAME record and not an NS record. For example a standard "www" record.

It is widely considered a "sub-domain" but I'd argue it is not, but a "regular" hostname (in case of aforementioned record types) instead.

Reason for that logic would be that a (sub-)domain is a domain/realm of entities (records managed via its nameservers). An A record would not satisfy such a definition.

Taken from Wikipedia

> A domain name is an identification string that defines a realm of administrative autonomy, authority or control within the Internet.

Though Wikipedia also follows the standard definition - https://en.wikipedia.org/wiki/Subdomain

I wonder if this is a similar misnaming as when people regularly confuse traffic and bandwidth.


  👤 mindcrime Accepted Answer ✓
Referring to the standard 'www' in www.example.com as a sub-domain may be a colloquialism, and it's probably fine in colloquial speech among non-experts. People to whom the distinction matters (eg, the people configuring DNS servers, etc.) will know and understand the more technical distinction.

Anyway, the meat of the answer - at least to the way I interpret this - is contained here (from the Wikipedia "Subdomain" page)

According to RFC 1034, "a domain is a subdomain of another domain if it is contained within that domain". Based on that definition, a host cannot be a subdomain, only a domain can be a subdomain. A subdomain will also have a separate zone file with a SOA record (Start of Authority).

So technically, no, if it has an A or CNAME record and points to a host, it's not a subdomain, it's a host.

Where I guess it gets confusing, and I'm not even sure if this is possible, is if you have something like:

a.shop.example.com --> points to some host A

b.shop.example.com --> points to some host B

shop.example.com --> points to some host Q

Is "shop" both a host AND a subdomain in that case? Assuming DNS even lets you do that. I dunno... never had a reason to think about it before.

EDIT: Yeah, looks like you can have the case where a given name is both a host and a sub-domain. See:

https://serverfault.com/questions/950698/use-same-dns-name-b...


👤 gostsamo
www is subdomain that was exposed to the wider internet in the times when people have had an internal network that mattered a.k.a at the times of only big corporations having internet at all. So, a corp.inc might've been the internal portal for the workers, while www.corp.inc was the public facingg page of the company.