Operating System - HP-UX
1827876 Members
1299 Online
109969 Solutions
New Discussion

Host name not getting resolved

 
SOLVED
Go to solution
jayachandran.g
Regular Advisor

Host name not getting resolved

Hi all

I have two servers in cluster. SRV1 and SRV2.One of the processes in SRV2 server is trying to get the hostname for the SRV1 servers ipaddress.

The Error: Unable to get the hostname for the ipaddress 10.1.1.1 (10.1.1.1 is the SRV1 ipaddress)

I have checked the /etc/hosts file, found that the ipaddress and the host name for this ipaddress is missing in both the servers.

Then I have added the ipaddress and host name in both of the servers.

But then too problem is not solved.

help me, thanks in advance

15 REPLIES 15
RAC_1
Honored Contributor
Solution

Re: Host name not getting resolved

Do both servers use /etc/hosts for host name resolution? Check /etc/nsswitch.conf file.
There is no substitute to HARDWORK
Victor BERRIDGE
Honored Contributor

Re: Host name not getting resolved

Hi,
Have you checked your /etc/nsswitch.conf file and /etc/resolv.conf, their perms and for nsswitch.conf if you do have something like:
hosts: files [NOTFOUND=continue] dns

Are these addresses correctly routed?
(correct subnet route, netmask..)

What are the perms on your hosts file? (444)

All the best
Victor
jayachandran.g
Regular Advisor

Re: Host name not getting resolved

Hi RAC/Victor

There is no nsswitch.conf (or) resolv.conf file in the servers.

I have already checked and rectified the host file.

entry for the ipaddress 10.1.1.1 was missing previously.And I have already added the missing Ipaddress to the host files.
Darrel Louis
Honored Contributor

Re: Host name not getting resolved

Hi,

Have you added the servers to the /etc/hosts file asfollow:

10.1.1.1 srv1.domain.com srv1

And as already mentioned check your /etc/nsswitch.conf file.
If the file doesn't exists copy it.
# cp /etc/nsswitch.files /etc/nsswitch.conf
Modify the line hosts:
hosts: files [ NOTFOUND=continue ] dns

Goodluck

Darrel Louis
MarkSyder
Honored Contributor

Re: Host name not getting resolved

You will probably have a file /etc/nsswitch.compat, which can be copied to nsswitch.conf.

You should set it up so it uses files first for hosts.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Victor BERRIDGE
Honored Contributor

Re: Host name not getting resolved

Hi again!
What servers and most important what cluster are you talking about?
It may be nothing to do with the servers themselves but more the way a process is looking for his "hostname"...
A cluster like mcSG will have on a host ist address (HW-server) + the addresses of the packages running on it....

All the best
Victor
Frank de Vries
Respected Contributor

Re: Host name not getting resolved

Otherwise you can create the nsswitch.conf
in the /etc directory and put this
contents in it

hosts: files [NOTFOUND=continue UNAVAIL=continue] dns [NOTFOUND=return UNAVAIL=continue TRYAGAIN=return]

If will first check your local /etc/hosts
and then check your dns

You can troubleshoot with nslookup command:

I have a host called frank only in /etc/hosts
10.214.9.118 frank

When I use nslookup it will show where it
resolved it.

[orapic@orasrv1:]/etc<>>> nslookup
Using /etc/hosts on: orasrv1

> frank
Using /etc/hosts on: orasrv1

looking up FILES
Name: frank
Address: 10.214.9.118

>

Good luck
Look before you leap
jayachandran.g
Regular Advisor

Re: Host name not getting resolved

Hi All

Host name to IP address maping is working fine.

Ip to Hostname is not working.

Regards
Jayachandran.G
spex
Honored Contributor

Re: Host name not getting resolved

Hi,

Try using nslookup to do reverse DNS:

# nslookup
# nslookup

If the IP address is resolved correctly, try restarting the processes. This will force them to re-read configuration.

Did you create /etc/nsswitch.conf and /etc/resolv.conf ?

PCS
Jaime Bolanos Rojas.
Honored Contributor

Re: Host name not getting resolved

Jayachandran,

Even thought it looks like we repeating ourselves, you should have 3 very important files in the system.

/etc/hosts
/etc/nsswitch.conf
/etc/resolv.conf

please make sure that they are on the system and configure properly. You can always type man and the name of the file for more info.

Regards,

jaime.
Work hard when the need comes out.
Chan 007
Honored Contributor

Re: Host name not getting resolved

Hi,

1. Try ping from Both servers with Hostname, not down the IP address.

2. Try to ping with those IP address, is this ping working?

3. Try to do a "tracert" from your desktop and check the hosts are reachable.

4. Check for hardcoding IP address in your script.

5. Run netstat -nr and check your gateway and mask are fin on both servers.

Chan
jayachandran.g
Regular Advisor

Re: Host name not getting resolved

Hi all

It is working now. Thanks for all of your valuble replies.

Steps that are followed to solve

1) Copied the file nsswitch.files as
nsswitch.conf

#cp nsswitch.files nsswitch.conf

(Tried nsslookup but fialed)

2) Except the line "hosts: file" all other
lines are hashed in the nsswitch.conf.

(Tried nsslookup but failed)

3) As if these servers are there in cluster,
hosts file where having more
then one ipaddress for the same server.

example
cat /etc/hosts

10.1.1.2 SRV1
10.1.1.1 SRV1

I have hased out other entries except for the ipaddress for which the error is reporting

cat /etc/hosts
#10.1.1.2 SRV1
10.1.1.1 SRV1

Now nssokup is working fine.

(Note: I have even removed my nsswitch.conf file then too nsslookup is working fine).

I supspect the entries in the hosts file.

Please correct me if i'm wrong.
Victor BERRIDGE
Honored Contributor

Re: Host name not getting resolved

Hi again,

Well you didnt tell us you had 2 entries to the same server in /etc/hosts, otherwise we would have said:
Its the first that is used...

It would have saved time in your first post to have given the content of /etc/hosts...

All the best
Victor
jayachandran.g
Regular Advisor

Re: Host name not getting resolved

Hi Victor

I accecpt that is a mistake..

I'm was trying nslookup for ipaddress and not for a hostname.So i felt multiple entires for the same hostname dosen't matter.

#nslookup
>10.1.1.1 (for this ipddress there is only one entry in my host file)


jayachandran.g
Regular Advisor

Re: Host name not getting resolved

Thanks for all your help..