Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Reverse DNS (PTR) and multiple hostnames.

Highlighted

Reverse DNS (PTR) and multiple hostnames.

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
Highlighted

Re: Reverse DNS (PTR) and multiple hostnames.

Master Collaborator

@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.

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven

Highlighted

Re: Reverse DNS (PTR) and multiple hostnames.

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,

Highlighted

Re: Reverse DNS (PTR) and multiple hostnames.

Master Collaborator

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.  

 

 

 

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven

Highlighted

Re: Reverse DNS (PTR) and multiple hostnames.

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

Don't have an account?
Coming from Hortonworks? Activate your account here