1825802 Members
2479 Online
109687 Solutions
New Discussion

Re: nslookup problem

 
SOLVED
Go to solution
Rgomes
Valued Contributor

nslookup problem

Hi All,


When I try to nslookup the server, it shows the below:
$ nslookup hps1_dc
*** Can't find address for server hps1_dc: Server failed
Using /etc/hosts on: hps1_dc

looking up FILES
Name: hps1_dc
Address: 10.16.1.2


Why it shows: "*** Can't find address for server hps1_dc: Server failed
Using /etc/hosts on: hps1_dc"

nslookup for other server does not show this message.

Thanks

Richard
8 REPLIES 8
T G Manikandan
Honored Contributor
Solution

Re: nslookup problem

This is because the server has a lookup order for hostname resolution like
first DNS then local hosts file.
this should be configured under /etc/nsswitch.conf file.

Now when you do a nslookup it reaches the DNS and tries to resolve the hostname "hps1_dc" but this could not be resolved with the DNS server as the DNS server has no entry for the server hps1_dc.
So it goes next to the local hosts file to resolve the hostname hps1_dc and finds it there.
Rgomes
Valued Contributor

Re: nslookup problem

Hi Manikandan,

There is no dns server running in our systems. And I found the nsswitch.conf file only on the hps1_dc server, no other server has it. So, they don't have any problem in the nslookup.

What to do? How can I change the nslookup's quary so it will not look in the nsswitch.conf file ?

Thanks

Richard

Michael Tully
Honored Contributor

Re: nslookup problem

Try this config in your /etc/nsswitch.conf file

# more /etc/nsswitch.conf
hosts: files [NOTFOUND=continue UNAVAIL=return TRYAGAIN=return]

To test startusing 'nslookup' that is certainly included in your /etc/hosts file.

If you have an /etc/resolv.conf file you may wish to remove it.
Anyone for a Mutiny ?
T G Manikandan
Honored Contributor

Re: nslookup problem

Inside your nsswitch.conf file

just use hosts

for the files line entry as Micheal suggested.

Revert
Rgomes
Valued Contributor

Re: nslookup problem

Hi Michael and Manikandan,

1)I have nsswitch.conf file which has following entry:

hps1_dc /etc #cat nsswitch.conf

hosts: files [NOTFOUND=continue] dns

Should I change it to:

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

Will this change nslookup behavior to look only on hosts file?

2) There is no resolv.conf file in etc dir. it has been changed to resolv.conf.copy, so it has no effect, I guess.

hps1_dc /etc #cat resolv.conf.copy
search cdbl.com
nameserver 10.16.1.2

THanks

Richard
T G Manikandan
Honored Contributor

Re: nslookup problem

1)yes
2)yes
Rgomes
Valued Contributor

Re: nslookup problem

Hi Manikandan and Michael,

Thanks for your help, problem solved by changing nsswitch.conf file.

Thanks

Richard
Andrew Cowan
Honored Contributor

Re: nslookup problem

With the limited information on offer I would say check your "/etc/resolv.conf" and "nsswitch.conf" files. I looks as though it either can't reach the DNS server, or the resolver order is set to /etc/hosts first.

I think the best thing is to provide your "/etc/resolv.conf", "nsswitch.conf", and an extract from "/etc/hosts".

You can also run nslookup with the "-d" switch and that should show exactly what the named process is doing.