5

I understand that, in the direction "webmail.chemistry.iit.edu", "chemistry" is a subdomain and "webmail" the hostname. Then, why in "mail.google.com", according to Google's documentation, is "mail" a subdomain? Isn't it mandatory to have the hostname to the left of the domain?

pepito
  • 53
  • 1
  • 1
  • 3

2 Answers2

6

No, it is not mandatory to have the any particular format for domain names. You can put almost anything you want in DNS, and companies do use all kinds of schemes.

That said, the word "hostname" if often used to mean two different things. It can mean

  1. The name of the computer. This can be in many different formats, including single words, full domain names, and anything in between.
  2. The full domain name of a computer, whether the computer does or does not have that full name set on the computer as its host name.

To complicate this, there is absolutely no reason that either of the things you mentioned in your question is a "hostname" in the first sense of the word. In fact, many places do not have a computer with the name "webmail", instead having that name point to another machine with a different name. For example, in my old office, "mail.example.com" actually could be on a machine named "mailserver2.office.example.internal". As you can see, the "hostname" in the first sense of the word is not even a publicly accessible address.

For your example of "mail.google.com", GMail actually runs on many servers (hundreds or thousands, though no one outside Google knows for sure) so there is no computer with the name "mail.google.com". Google does not publish the actual names of the servers that "mail.google.com" points to. Even when you see "googlemail.l.google.com" when you look up the where it points to, that is also not the real name of the server, but a name that points to many servers.

For example, there could be a server named "webmail01-newyork342-version1.googlemail.datacenter-newyork.google.private" which is publicly accessible as "googlemail.l.google.com". Google uses DNS round-robin, region-based DNS partitions, and IP anycasting to make all of those servers respond to the same name.

In smaller setups, it is often true that the leftmost portion of the full address is the name of the machine that you are connecting to, but that is rarely the case when dealing with any large company.

Moshe Katz
  • 3,053
  • 3
  • 26
  • 41
  • Yes, I just want to exlain to pepito, It is not a subdomain, It is a hostname of some mail servers. **subdomain** and **hostname**, It is pepito's problem. – cuonglm May 12 '13 at 17:41
  • Why doesn't Google assign the servers that are pointed to "googlemail.l.google.com" directly to "mail.google.com"? Wouldn't it be simpler to manage? – pepito May 12 '13 at 18:17
  • 1
    Google uses similar setups for many of their products. See maps.google.com, calendar.google.com, and others. I would guess they do it for DNS caching reasons. Note that the TTL (caching time) of the main records is one week (604800 seconds), while the TTL of the "l" records is only 5 minutes (300 seconds). – Moshe Katz May 12 '13 at 20:31
1

Isn't it mandatory to have the hostname to the left of the domain?

Almost, exclude when you creat an A record with no name, and point it to address of a server in domain, then the name of this server in domain is domain.com. You must know the different between hostname and domain name.

Then, why in "mail.google.com", according to Google's documentation, is "mail" a subdomain?

No, mail is just an alias for the mail servers of google, its really name is googlemail.l.google.com, you can using DNS tool to find it.

cuonglm
  • 2,346
  • 2
  • 15
  • 20
  • Google has far more than one mailserver. googlemail.l.google.com is also an alias. – Moshe Katz May 12 '13 at 17:36
  • No, you are wrong, the googlemail.l.google.com is real name, not alias. It has an A record. – cuonglm May 12 '13 at 17:42
  • 1
    But it is still pointing to many servers, *none of which* has that name in its OS configuration. They are still using it as an alias for multiple servers, using DNS round-robin and IP multicasting. See my update. – Moshe Katz May 12 '13 at 17:43
  • Yes, but it still only "one" for anyone who is outside of google.com and is not alias. The load balancing is beyond the pepito's question. – cuonglm May 12 '13 at 17:48