1838769 Members
2193 Online
110130 Solutions
New Discussion

DNS

 
Rob Wallner
Advisor

DNS

I have a weird problem with my system.

I can not ping via host names.

THe dns servers are set correctly. And I have the hosts names in the /etc/host file.

if I ping server1 It takes for ever before it times out.

If I ping server1's ip address it works fine.

I am stumped.

A nslookup wants to use the host file and not the DNS server.
8 REPLIES 8
Patrick Wallek
Honored Contributor

Re: DNS

What do your /etc/resolv.conf and /etc/nsswitch.conf files look like?

The nsswitch.conf should have a line similar to:

hosts: files [NOTFOUND=continue] dns
Pete Randall
Outstanding Contributor

Re: DNS

It sounds like your nsswitch file is set to use hosts prior to DNS. This is fairly normal and the /etc/nsswitch.conf entry should read something like this:
hosts: files[NOTFOUND=continue UNAVAIL=continue] dns [NOTFOUND=continue UNAVAIL=
continue TRYAGAIN=return] nis

That's all one line, by the way.


Pete

Pete
Carlos Roberto Schimidt
Regular Advisor

Re: DNS

Hi, if you want nslookup search first in DNS, have configure file /etc/nsswitch.conf

hosts: dns [NOTFOUND=continue] files [NOTFOUND=continue]

Mark Greene_1
Honored Contributor

Re: DNS

Check the /etc/resolv.conf per Pete's suggestion. If that is fine, then the problem is in DNS. Most likely there is no reverse-record for the host in question; i.e. there's a host name record in the zone for the network segment it's on, but there's no xxx.xxx.xxx.xxx-IN-ADDR.ARPA record for it.

mark
the future will be a lot like now, only later
Geoff Wild
Honored Contributor

Re: DNS

I tend to do it like so:

hosts: files [NOTFOUND=CONTINUE] dns


but that is mainly for ServiceGuard.

You can do DNS first, hosts second.

Make resolv.conf is setup - I also adjust the time out:

# cat /etc/resolv.conf
domain mydomain.net
nameserver X.X.X.X
nameserver X.X.X.X
nameserver X.X.X.X
retrans 1000
retry 2

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Bill Hassell
Honored Contributor

Re: DNS

It's important to note that searching /etc/hosts first is a reliability enhancement, especially when the primary DNS server is not an ultr-reliable system. The correct behavior for nslookup is to follow the rules in the /etc/nsswitch.conf file. If it says file then dns, it will (instantly) search through /etc/hosts and if not found, immediately ask the DNS server(s). If the first DNS server does NOT know the hostname, the search ends because properly configured DNS servers know how to locate hostnames, either locally or referred to another DNS server. If multiple DNS servers are listed in /etc/resolv.conf, the 2nd and 3rd servers are only consulted if the first server is dead -- that does not mean the server responded with hostname not found. It means the server simply refuses to respond to the request.

Now to test a DNS server, use the often overlooked feature of nslookup: specifying the DNS server to use. Just lookup a failing hostname with desired the DNS server as the second parameter:

nslookup failed_hostname 12.34.56.78

This forces nslookup to bypass the nsswitch.conf file and simply query the server located at 12.34.56.78. Repeat for other DNS servers.


Bill Hassell, sysadmin
Sivakumar TS
Honored Contributor

Re: DNS


Hi Rob,

Pls ensure that you /etc/nsswitch.conf has a line ,

hosts: files [NOTFOUND=continue] dns

or

hosts: dns
( if you want to resolve ALL HOSTS thru dns)

Regards,

Siva.
Nothing is Impossible !
rmueller58
Valued Contributor

Re: DNS

On the UX box you need to configure a DNS resolver.. this "can" be done through SAM.

You need to make your it points to your primary DNS server.. Also, you need to make sure DNS routing and firewall is allowed from your HP Box to the Primary DNS..