1830979 Members
2015 Online
110018 Solutions
New Discussion

dns client

 
SOLVED
Go to solution
Animesh Chakraborty
Honored Contributor

dns client

Hi,
I have configured DNS client.
edited /etc/resolve.conf and /etc/nsswitch.conf
When I do nslookup it works fine but after that swlist complains that "Could not contact host."
my /etc/resolve.conf looks like this:
#####################
domain hostA.xyz.abc.net
search xyz.abc.net
nameserver xxx.xx.xx.xx
nameserver xxx.xx.xx.xy
############################
If I remove resolve.conf ,swlist works fine

Thanks for your suggestions
Animesh
Did you take a backup?
9 REPLIES 9
Steven Sim Kok Leong
Honored Contributor

Re: dns client

Hi Animesh,

I believe your domain in your /etc/resolv.conf should be xyz.abc.net instead of hostA.xyz.abc.net.

Hope this helps. Regards.

Steven Sim Kok Leong
Animesh Chakraborty
Honored Contributor

Re: dns client

Hi Steven,
Thanks but it does not help :(
Did you take a backup?
Steven Sim Kok Leong
Honored Contributor

Re: dns client

Hi Animesh,

Modify your /etc/nsswitch.conf:

hosts: files [NOTFOUND=continue] dns

Also, try restarting your swagentd:

# swagentd -r

Hope this helps. Regards.

Steven Sim Kok Leong
pap
Respected Contributor
Solution

Re: dns client

Hi Animesh,
I think your order in resolv.conf file for name server lookup is not proper.

Please do following .
nslookup to your host and see if dns ruturns anything?

May be your hostname entry is not in DNS database. Please update DNS database and ten try to do swlist.

Hope that helps.

You do not need to do anything with nsswitch.conf becasue if you put the hosts entry first , it will not look for DNS unless yur host finds nothing in /etc/hosts....

I am sure your hostname entry is not in DNS or else DNS order you need to change in your resolv.conf file.

-pap
"Winners don't do different things , they do things differently"
Jeff Schussele
Honored Contributor

Re: dns client

Hi animesh,

You don't need a domain line in resolv.conf. The search line effectively set the domain(s). I would remove the domain line & leave the search line as is.
Also the search order in the nsswitch.conf is important. If you have files first ensure the entry in the hosts file matches the host & doamin parts in the resolv.conf file.
Also you should check the DNS servers to insure you're in there. enter nslookup interactively by not specifying a host then enter
server DNS_server_ip
Then enter your host name & do reverse lookup by entering your host IP as ell. If either returns not found then have the DNS admins correct the entry.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sachin Patel
Honored Contributor

Re: dns client

Hi Animesh,
You need either search or domain line but not both.


Sachin
Is photography a hobby or another way to spend $
Steven Sim Kok Leong
Honored Contributor

Re: dns client

Hi Animesh,

For availability and security reasons, I would personally prefer to set usage of /etc/hosts file before usage of the DNS servers in /etc/nsswitch.conf, i.e. use /etc/hosts for resolving critical hosts such as the local server and DNS for resolving non-critical hosts such as clients.

Since your swlist works when resolv.conf was not in place, your /etc/hosts file is already populated correctly with your host-to-ip entry.

Imagine the scenerio that your DNS servers could not be contacted over the network , your swlist (and swinstall, swremove as well) will likely fail in the following scenerios:
1) when DNS server is down
2) when router is down
3) when in single-user or maintenance mode

Apart for availability reasons, from the security aspect, relying on /etc/hosts for translating host-to-ip for critical hosts reduce the chances of your system receiving illegitimate entries e.g.: spoofed DNS replies via
1) poisoned DNS cache
2) man-in-middle attacks
3) spoofed DNS servers

Hope this helps. Regards.

Steven Sim Kok Leong
Animesh Chakraborty
Honored Contributor

Re: dns client

Hi Steven,
good suggestion.
But my question is when DNS server is down why
swlist not picking up the hostname from /etc/hosts?
Yesterday the hostname was not there in dns databse and after putting entry in dns swlist started working but when dns is not available as you mentioned swlist will not work.
And the reverse lookup is also not implemented in our dns server.Is that the reason?
Did you take a backup?
Steven Sim Kok Leong
Honored Contributor

Re: dns client

Hi Animesh,

>> But my question is when DNS server is down why
swlist not picking up the hostname from /etc/hosts?

1) check /etc/hosts file whether the host entry is there:

1.2.3.4 hostA hostA.xyz.com

2) check /etc/nsswitch.conf:

hosts: files [NOTFOUND=continue] dns

This will ensure that /etc/hosts is read before the DNS server is used to resolve the host names.

Hope this helps. Regards.

Steven Sim Kok Leong