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:
Is the Hostname in machine (for example when typing
hostname
in debian OS ssh) different from Hostname that you type in DNS serverA
Record?Is it normal to have my Debian Machine hostname set as
maximus
and have the DNS A Record Hostname set asmail
?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?
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.
hostname
returns what you have configured the system to consider to be its hostname. There may be any number ofA
/AAAA
records pointing to IP addresses associated with this system.That in itself is not abnormal. I would, however, expect an
A
/AAAA
record for the name beginning withmaximus
as well, as that appears to be the canonical name in your example.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).hostname
returns what you have configured the system to consider its hostname (egmaximus
).hostname -f
will return the former with the domain appended, forming the FQDN (egmaximus.example.com
). The domain is often based on an entry in thehosts
file. Thehost
command, if that is what you refer to, is a DNS-only tool.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.