Operating System - HP-UX
1825316 Members
5070 Online
109679 Solutions
New Discussion юеВ

DNS servers in /etc/resolv.conf

 
SOLVED
Go to solution
Albert Goodman
Advisor

DNS servers in /etc/resolv.conf

Hi,

Is it possible to force hostname resolution to go through multiple DNS servers defined in /etc/resolv.conf until a resolution is done or the list of DNS servers is exhausted?

Eg: if /etc/resolv.conf contains
domain abcdef.com
nameserver nn.mm.xx.111
nameserver nn.mm.xx.222

is it possible to force the resolution process to attempt to use the second server if the first server returns NOTFOUND ?

Thanks,
9 REPLIES 9
Adisuria Wangsadinata_1
Honored Contributor

Re: DNS servers in /etc/resolv.conf

Hi,

Yes, it's possible.

Check the manpage of resolv.conf for more details :

# man resolv.conf

Hope this information can help you.

Cheers,
AW
now working, next not working ... that's unix
Sivakumar TS
Honored Contributor

Re: DNS servers in /etc/resolv.conf


Hi Albert,

A nameserver entry defines the Internet address of a remote DOMAIN name server to the resolver routines on the local domain.
Which is in the form of, The Address variable is the dotted decimal address of the remote name server.

If more than one name server is listed, the resolver routines query each name server (in the order listed) until either the query succeeds or the maximum number of attempts have been made.

we dont have to do anything particularly to achive your requirement.

With Regards,

Siva.

Nothing is Impossible !
Sameer_Nirmal
Honored Contributor

Re: DNS servers in /etc/resolv.conf

Hi,

Hostname resolution using "resolv.conf" could be possible upto 3 nameservers. You can put them in the preferred order depending on your setup to get faster resolution.
If those nameservers are from different subdomains, then you can use "search" in the "resolve.conf".

If any of the nameservers is not available and depending upon timout policy you set, the other nameserver is tried atomatically. The timout policy is defined using "retrans" and "retry" option. Refer "resolver" man page for details of the options.

The hostname lookup for dns is assumed to be defined "nsswitch.conf" file.
Geoff Wild
Honored Contributor

Re: DNS servers in /etc/resolv.conf

That is how DNS should work...

By default, the resolver does this:

[SUCCESS=return NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue].

So, if the first server is busy, or can't find the answer, then it goes to the next, and so on...

You can speed up the process by setting in resolv.conf retry and retrans:

retry 2
retrans 1000

Which tells the server to retry only twice and 1000 ms....

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.
Tvs
Regular Advisor

Re: DNS servers in /etc/resolv.conf

Hi Albert.

Add Search option in resolv .conf

example: search abcdef.com
nameserver dd.ff.ff.tt
nameserver ee.ff.tt.gg

this can be solve your problem

regards

tvs
Muthukumar_5
Honored Contributor

Re: DNS servers in /etc/resolv.conf

hostname lookup is based on /etc/nsswitch.conf 's hosts: entry.

You can have 3 nameservers setup in /etc/resolv.conf.


[NOTFOUND=contiue] method in /etc/nsswitch.conf for dns entry.

Before putting that check with nsquery command. It is good one.

--
Muthu
Easy to suggest when don't know about the problem!
Jeff_Traigle
Honored Contributor
Solution

Re: DNS servers in /etc/resolv.conf

I think most of the answers have misinterpretted your question. The resolver will not traverse the list of nameservers in resolv.conf if the lookup fails on the first in the list, unless that nameserver does not respond (UNAVAIL). If the first nameserver in the list is up and responds that it cannot find the address, then the next lookup protocol (files, NIS, etc.) is used. The intent of the multiple lines in resolv.conf is to provide DNS lookup redundancy, not individually unique DNS lookups before moving to the next protocol.
--
Jeff Traigle
Bill Hassell
Honored Contributor

Re: DNS servers in /etc/resolv.conf

As Jeff points out, the resolver checks DNS and expects an answer or a referral. If the DNS server does not properly refer to the server that knows the address, it is misconfigured and should not be used. The multiple entries in resolv.conf are for dead or unresponsive DNS servers, BUT it takes a long time (25 secs by default) to try the next entry. DNS is so critical to networking that unreliable servers should be fixed or taken out of service.

A highly desirable alternative for DNS is to use /etc/host as the first resolver rather than DNS. Put the (relatively few) production IP addresses in hosts and now DNS will not have nearly the impact it does when it fails. Use nsswitch.conf to configure this behavior (man switch).


Bill Hassell, sysadmin
Albert Goodman
Advisor

Re: DNS servers in /etc/resolv.conf

Thank you all,

So I believe the short answer is "no", which my own experience has also borne out.