2

This might sound stupid and basic to some of you, but I am still so confused about this even after reading numerous sources on the net. My questions still unclear are:

  1. Is the Hostname in machine (for example when typing hostname in debian OS ssh) different from Hostname that you type in DNS server A Record?

  2. Is it normal to have my Debian Machine hostname set as maximus and have the DNS A Record Hostname set as mail?

  3. Are these 2 the same that I am confused thinking of them as separate or are they usually used in interchangeable term causing the confusion?

  4. When it comes to FQDN, for the host part, does it use the hostname of the machine or the hostname given in the DNS A record?

My setup: 1 Debian 7 VPS with web server and mail server both on the same box.

Sven
  • 98,649
  • 14
  • 180
  • 226
Neel
  • 1,441
  • 7
  • 21
  • 35

2 Answers2

3
  1. hostname returns what you have configured the system to consider to be its hostname. There may be any number of A/AAAA records pointing to IP addresses associated with this system.

  2. That in itself is not abnormal. I would, however, expect an A/AAAA record for the name beginning with maximus as well, as that appears to be the canonical name in your example.

  3. These are not conceptually the same but the expectation is that there is an overlap. Ie, if you have configured the system to consider maximus.example.com to be its FQDN, there is an expectation that this name exists in DNS as well (possibly in addition to many other names).

  4. hostname returns what you have configured the system to consider its hostname (eg maximus). hostname -f will return the former with the domain appended, forming the FQDN (eg maximus.example.com). The domain is often based on an entry in the hosts file. The host command, if that is what you refer to, is a DNS-only tool.

Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94
  • Thank you @Hakan What caused me this confusion is when I was learning to set up a mail server in my Vps. So from you answer, I now understand that my machine name as Maximus.domain.com and I can still have different A names pointing to this. For example have A and mx record for email services as mail.domain.com and another A name for web server as host.domain.com and both of them pointing to the machine name Maximus.domain.com. Is that right? – Neel Oct 25 '14 at 10:48
  • @blackops_programmer Yes, you can have any number of additional names pointing to it. – Håkan Lindqvist Oct 25 '14 at 10:58
  • Thanx. That clears the hours of confusion I was having. Really appreciate the answers from you and @Dom :) – Neel Oct 25 '14 at 11:04
2

The hostname of your computer is IN your computer. You can not see it outside it. In your case, 'maximus' is the hostname.

The DNS is a distributed database available in DNS servers. You can ask to the DNS some informations. You can record in the DNS what you want and different from the hostname. In your case, your DNS record A is "mail"

There is nothing normal or abnormal. The two informations are in different storages and can be also different.

Dom
  • 6,743
  • 1
  • 20
  • 24