Operating System - HP-UX
1822036 Members
3497 Online
109639 Solutions
New Discussion юеВ

can't resolve localhost (!)

 
SOLVED
Go to solution
David Losada
New Member

can't resolve localhost (!)

I know this might very well be a stupid question, so I beg for your pardon in advance.

We've got a HP-UX 11.00 server which has no way to resolve localhost to IP 127.0.0.1. We've got an entry for it in /etc/hosts, but it doesn't work. I've asserted that disabling /etc/resolv.conf (by renaming it or by another means) "solves" the problem. But, of course, we need the /etc/resolv.conf.

In a nuthsell... is there any way to make it resolve through /etc/hosts when DNS is not satisfactory?

thanks
8 REPLIES 8
Deepak Extross
Honored Contributor
Solution

Re: can't resolve localhost (!)

I think what you're looking for is nsswitch.conf.
See "man nsswitch.conf" for details. A search on this forum for nsswitch.conf should throw up some useful information.

Hope this helps.
melvyn burnard
Honored Contributor

Re: can't resolve localhost (!)

set up the /etc/nsswitch.conf file to either use files first, or go to files if DNS does not resolve.
example:

hosts: dns [NOTFOUND=continue] files
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Ruediger Noack
Valued Contributor

Re: can't resolve localhost (!)

Edit your /etc/nsswitch.conf file like this:hosts: dns [NOTFOUND=return] files

There are some sample files for nsswitch.conf in /etc dir (nsswitch.*).

Ruediger


John Strang
Regular Advisor

Re: can't resolve localhost (!)

Hi David,

Check your /etc/nsswitch.conf file

for the line beginning "hosts"
This gives the sequence of searching for hosts, and can be edited accoring to your requirements.

In your case, it sounds as if the first entry should be "files" - other options are dns, nis or nisplus

HTH,

John
If you never make a mistake you'll never make anything.
David Losada
New Member

Re: can't resolve localhost (!)

Thanks everybody

problem is solved. used the nsswitch.files and modified the hosts entry as suggested.

thanks a lot, again :)
Bill McNAMARA_1
Honored Contributor

Re: can't resolve localhost (!)

probably worth mentioning here.. SAM has a pretty thorough interface to configure the lookup switch order.. you should have a look at the options (quicker than the man)

Later,
Bill
It works for me (tm)
David Losada
New Member

Re: can't resolve localhost (!)

thanks a lot for the pointer. The fact is that this is a server I'm assigned to admin and I've received no training on HP-UX (even though I've learned the nsswitch.conf is a general thing, thanks a lot).

SAM looks like a very useful tool, thanks
Steven Sim Kok Leong
Honored Contributor

Re: can't resolve localhost (!)

Hi,

From the security perspective, I would suggest that you use the following order in /etc/nsswitch.conf:

hosts: files [NOTFOUND=continue] dns

instead of

hosts: dns [NOTFOUND=continue] files

For critical systems, hardcode the host-ip pairing in /etc/hosts. This ensures that even if the DNS server or its records get compromised, you can be assured that you are still connecting to the correct IP addresses of the critical systems.

Such a configuration of files before dns in nsswitch.conf would be applicable in scenerios such as on a web application server connecting to the database server backend to perform queries etc.

Hope this helps. Regards.

Steven Sim Kok Leong