Operating System - HP-UX
1819803 Members
2943 Online
109607 Solutions
New Discussion юеВ

Re: ping localhost fails when resolv.conf present

 
SOLVED
Go to solution
Franz Herzog
Occasional Advisor

ping localhost fails when resolv.conf present

Hi
I'am trying to install Oracle Application server 10g on HP-UX11i(11.11) and run into the following problem

ping localhost only works when no /etc/resolv.conf is present (for the exception see later)

The last entry in my /etc/hosts is
127.0.0.1 localhost loopback

The resolv.conf looks like
domain milloltingen.ch
nameserver 192.168.2.1
nameserver 192.168.2.2

I have tried to work with the policy mechanism by using /etc/nsswitch.conf
Taking HP default values I can ping any host except localhost and loopback
Interchange dns/files in the hosts line of nsswitch.conf allows to ping localhost and loopback but nothing else

nslookup of any host tells my that the lookup policy of nsswitch.conf is working, but I don't get ping localhost to work

Any idea or does anybody know of a bug with these symptoms

Any suggestions appreciated
12 REPLIES 12
Mark Grant
Honored Contributor
Solution

Re: ping localhost fails when resolv.conf present

Have a look at /etc/nsswitch.conf and make sure that the system includes "files"

something like this

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

This way, the system tries /etc/hosts first where it will find localhost. Just make sure that you don't have any IP addresses in /etc/hosts that conflict with any DNS entries you have.

Never preceed any demonstration with anything more predictive than "watch this"
Franz Herzog
Occasional Advisor

Re: ping localhost fails when resolv.conf present

Hi Mark
Thanks for this real fast answer that already solved the problem:
In my nsswitch.conf I erronously had the entry "files [NOTFOUND=return]..." and therefore it is clear that DNS is not addresses.
After the error has be found, the error mostly seems obvious.
Thanks a lot and best regards
Franz H.
Mobeen_1
Esteemed Contributor

Re: ping localhost fails when resolv.conf present

Franz,
I am glad that your problem got resolved quickly. In the same lines, i would appreciate if you could take some time off and assign points to Mark, who helped you on this.

Thanks
Mobeen
Joseph Loo
Honored Contributor

Re: ping localhost fails when resolv.conf present

hi,

what is in the file, /etc/nsswitch.conf is important. copy /etc/nsswitch.hp_defaults to /etc/nsswitch.conf where the following line is found:

# cp -p /etc/nsswitch.hp_defaults /etc/nsswitch.conf

hosts: dns [NOTFOUND=return] nis [NOTFOUND=return] files

will work.

regards.
what you do not see does not mean you should not believe
Joseph Loo
Honored Contributor

Re: ping localhost fails when resolv.conf present

sorry to add this line, the default line for /etc/nsswitch.hp_defaults is

hosts: dns [NOTFOUND=return] nis [NOTFOUND=return] files

change it to:

hosts: files dns [NOTFOUND=return] nis [NOTFOUND=return]

regards.
what you do not see does not mean you should not believe
Franz Herzog
Occasional Advisor

Re: ping localhost fails when resolv.conf present

Hi Joseph
Thank you too for your reply. I also tried this version: works as well

Best regards and thanks
Franz H.
Franz Herzog
Occasional Advisor

Re: ping localhost fails when resolv.conf present

Hello
Having installed the whole Oracle 10g stuff I realized that starting opmnctl lasts very long. So I tried to trace the problem:
Indeed, there still is something wrong with my network configuration:
Eventhough I can ping all the adresses I want, I have no chance to use nslookup when /etc/resolv.conf is present: No feedback at all, I don't even get to the nslookup prompt. What I am doing wrong? Is there a log-file, where I can check what nslookup is trying (no entries in /var/adm/syslog/syslog.log)

Any suggestion will be appreciated.
regards Franz H.
Mark Grant
Honored Contributor

Re: ping localhost fails when resolv.conf present

Franz,

This would suggest that you either can not connext to the DNS servers sepcified in /etc/resolv.conf or /etc/resolv.conf is wrong or you still have an issue with nsswitch.conf.

If you can, it might be worth posting these last two files to the forum. I'd also suggest creating a new thread on the here because people will see the little "bunny" icon an assume the thread is closed. You won't get so many eyeballs on it :)
Never preceed any demonstration with anything more predictive than "watch this"
SAHA
Honored Contributor

Re: ping localhost fails when resolv.conf present

Hi,

Try to recreate those two files. There may be some syntax error or unwanted character.

A simple nsswitch.conf:

hosts: files dns nis


A simple resov.conf

domain xyz.com
nameserver 10.64.21.100

Thanks,
You must PASS failure on way to success !!!
SAHA
Honored Contributor

Re: ping localhost fails when resolv.conf present

Hi,

Try to recreate those two files. There may be some syntax error or unwanted character.

A simple nsswitch.conf:

hosts: files dns nis


A simple resolv.conf

domain xyz.com
nameserver 10.64.21.100

Thanks,
You must PASS failure on way to success !!!
Franz Herzog
Occasional Advisor

Re: ping localhost fails when resolv.conf present

Hi
The files you mention are already that simple as you suggest, but the behaviour of nslookup (no reaction at all) originates from the fact that the namesserver was not up; I would have expected, that in this case the answer of nslookup simply comes from /etc/hosts. This in fact is only true when the namesserver is available.
Eventhough this problem is not really a problem any longer, an Oracle installation (10g Application Server) lasts much longer when there is a /etc/resolv.conf file there. (So, for the time of installation, just move resolv.conf to resolv.conf.sav)
On OS-level querying /etc/hosts or the namesserver doesn't make a big difference.

Thanks to all of you for helping me.
Regards Franz H.
Bill Hassell
Honored Contributor

Re: ping localhost fails when resolv.conf present

When nslookup seems to hang, then your DNS server is down. Just wait about 20 seconds for the next entry in resolv.conf to be tried. If there are 3 DNS servers and all of them are unreachable or not working, then it will take 90 seconds to return. The key here is to tell nslookup what you'd like to do. But before you start, tell nslookup to query a specific DNS server as in:

nslookup localhost 12.34.56.78

where 12.34.56.78 is your DNS server. In this case, if the server is working, it will report back that it cannot locate localhost: Non-existent domain which is to be expected. So put the non-DNS entries in /etc/hosts, and change nsswitch.conf to always look in /etc/hosts first, then query the nameservers found in resolv.conf. You can also use nsquery (more options) to check you nameservers.

OTE: nslookup will ask the first nameserver if it knowns it's own name. If not, you'll get an error that it cannot validate the nameserver. This is a security check that many DNS admins forget about. DNS is a high security risk so validating the the DNS server is really a legal server is important.


Bill Hassell, sysadmin