Tuesday, January 12, 2016

domain name system - Confused about Linux Hostname, DNS Hostnames and FQDN Hostname




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.


Answer




  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.



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...