Support Questions

Find answers, ask questions, and share your expertise

Reverse DNS (PTR) and multiple hostnames.

avatar
Explorer

Hi

 

I have an example scenario where a given VM has 3 hostnames/aliases:

1) host01.dom.com

2) althost01.dom.com

3) host-h01.dom.com

 

All these point to the same IP, 123.123.123.123 .  When doing a reverse DNS lookup, only the third one is returned.  This causes issues, of course, if the hosts have been added to CM using the 1) name.  

 

I've no access to the DNS server. 

 

Is there a way to change the default CDP / CDH / CM behaviour or lookup so a reverse lookup by the above IP returns hostname 1) instead of 3)?

 

In other ways, is there a way to 'trick' Cloudera into thinking that the hostname is 1)?  Or am I locked into using the 3) option?  

 

The reason for this is if a scenario arises where 3) is not a very friendly name to work with and we need something friendlier but also where we have no control of the DNS from our side.  

 

Thx,

4 REPLIES 4

avatar
Super Guru

@TCloud use /etc/hosts to set the fqdn you want to the ip you want. When this host mapping and the hostname is set, then reboot and check again that everything stays as you set it after reboot when it comes back online.

avatar
Explorer

That still didn't work.  I tried to add various entries into /etc/hosts but no luck, even with nsswitch.conf hosts set to files, when doing reverse lookups, the request is still sent to the /etc/resolv.conf  nameservers which is then sent up to be resolved by the DNS.

 

Do you have specific /etc/hosts example that will work and properly return reverse PTR records?  

 

Thx,

avatar
Super Guru

Your /etc/hosts file is a mapping of a hostname to an IP. What is in /etc/hosts will override any dns settings.  That is the whole point of using /etc/hosts/.   Also the hostname of each machine should be same as the hostname you use in /etc/hosts to map to the the IP.  

 

You should be setting the hostname, and /etc/hosts accordingly before install anything.  This should be done on all hosts, and all hosts of cluster should be listed in /etc/hosts on each machine.  Assuming you have more than one node in the cluster.   

 

You can set hostnames to be whatever FQDN you want, just make sure they persist after reboot.  In some OS's the /etc/hosts file and hostname file(s) are managed (manual changes over-written during reboot). So make sure you set them both per node, reboot, and check.

 

You need to get the machines working on a single hostname and a single ip.  This is the problem and is a documented requirement for working in CDH/CDP/HDP/etc.  

 

 

 

avatar
Explorer

Given these hostnames exist for this one server:

 

1) host01.dom1.com

2) althost01.dom2.com

3) althost01.dom3.com

 

I added the entries into /etc/hosts like this:

127.0.0.1localhost localhost.localdomain localhost4 localhost.localdomain4

1.2.3.4 host01.dom1.com althost01.dom2.com  althost01

.

(rest of servers)

.

.

.

 

Reverse lookup on 1.2.3.4 still returns:

 

althost01.dom3.com

 

wich is not one of the entries in /etc/hosts .  So thinking there must be something else that directly sends it over to the DNS, if not /etc/resolv.conf entries as per my earlier suggestion.  

 

Thx