Operating System - HP-UX
1844219 Members
2744 Online
110230 Solutions
New Discussion

Problems with nsswitch and resolv

 
SOLVED
Go to solution
Roy Shiladitya
Advisor

Problems with nsswitch and resolv

Hi,
I have a host which I am trying to configure as a DNS client .
Have created /etc/resolv.conf and /etc/nsswitch.conf files as below..

/etc/reslov.conf
domain XXX.com.au
nameserver < nameserver IP >
nameserver < nameserver IP >

/etc/nsswitch.conf
hosts: files[NOTFOUND=continue] dns [NOTFOUND=return UNAVAILABLE=RETURN TRYAGAIN=return]

The problem I have is if for some reason the nameservers are unreachable , new telnet /ftp connections start timing out . Also , nslookup just hangs . And the moment I comment out the resolv.conf entries things are back to normal.
I thought having a nsswitch.conf would prevent the system locking up incase the nameservers are unavailable , but this does not seem to be the case.
Any ideas ???
I also noticed that when I configured the nsswitch thru SAM it said that needed to rebbot the host for all changes to take effect. Could this be the issue. I do not have the luxury to do a reboot without going through piles of paperworks and authorizations and was hoping to get around without having to do so....

regards,
Roy
8 REPLIES 8
RAC_1
Honored Contributor

Re: Problems with nsswitch and resolv

You do not need to reboot when you configure nsswitch.conf file . This is for sure. What SAM is telling is not right.

You have two dns servers. And if both have problems, it will take some time to get error message. And for this time period you may feel that the nslookup is hung. It takes a 30 secs to timeout one dns server and go onto next. so in your case, if both are not available, you will receive a error message/timeout after 1 min.

you may also want to add search directive after domain directive in resolv.conf file.
There is no substitute to HARDWORK
Roy Shiladitya
Advisor

Re: Problems with nsswitch and resolv

Hi thanks for the information. Is there anyway to shorten the timeout period so that it does not wait that long incase the nameservers are not available?

Regards,
Roy
Muthukumar_5
Honored Contributor

Re: Problems with nsswitch and resolv

Change /etc/nsswitch.conf file as,

hosts: files dns

It is enough for normal setup. If you are getting timeout then, change nameserver order in /etc/resolv.conf file. Put nameserver ip which is having more entries infront of other nameserver.

You can check different resolvation timing with,

# timex nsquery hosts "files dns"
# timex nsquery hosts "files[NOTFOUND=continue] dns [NOTFOUND=return UNAVAILABLE=RETURN TRYAGAIN=return]"

-Muthu


Easy to suggest when don't know about the problem!
RAC_1
Honored Contributor

Re: Problems with nsswitch and resolv

I think 30 seconds is default. (But not sure.)
Check man page of resolver. man 4 resolver
you can put retrans and retry options in config file.
There is no substitute to HARDWORK
Roy Shiladitya
Advisor

Re: Problems with nsswitch and resolv

Thanks guys, seems like there is no way around the fact that if both the nameservers are unavailable , There will be delays to new connections (Telnets/Ftps) to the host. Or is there ?

Regards,
Roy
Arunvijai_4
Honored Contributor

Re: Problems with nsswitch and resolv

Yes, there will be a slight delay in connection if both nameservers are offline or not available.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Roy Shiladitya
Advisor

Re: Problems with nsswitch and resolv

Thanks for your help guys.
Roy
Muthukumar_5
Honored Contributor
Solution

Re: Problems with nsswitch and resolv

If both of the nameserver is not working then you cann't connect. Based on name resolvation + routing only you can remotly login into another machine.

You can add hostname, fqdn and ip-address in /etc/hosts (file repository) and start resolving hosts with files itself. You can have a common /etc/files setup to all unix machines with format as,



It will be good when both of the nameserver is down.

When you are remotly connecting machine then choose IP-Address instead of hostname.

-Muthu
Easy to suggest when don't know about the problem!