1833625 Members
3643 Online
110062 Solutions
New Discussion

Two DNS Servers

 
SOLVED
Go to solution
Michelle Barton
Frequent Advisor

Two DNS Servers

My environment has a primary and alternate DNS server that resolves all internal names and then a 3rd that resolves internet addresses. The primary and alternate are identical to each other, and the alternate is used if the primary is down. How can I configure the system to look at DNS and the 3rd server used for internet resoltuion? We are trying to get paging to work by interfacing with airtouch.net. Your help is greatly appreciated.

Thanks,
Michelle Hames
Xtra Corp
7 REPLIES 7
Kofi ARTHIABAH
Honored Contributor

Re: Two DNS Servers

Michele:

you should list all your dns servers (in order in the /etc/resolv.conf file):

#echo "domain yourlocal.domain.com" > /etc/resolv.conf
#echo "search yourlocal.domain.com" >> /etc/resolv.conf
#echo "nameserver AAA.AAA.AAA.AAA # first DNS server" >> /etc/resolv.conf
#echo "nameserver BBB.BBB.BBB.BBB # second DNS server" >> /etc/resolv.conf
#echo "nameserver CCC.CCC.CCC.CCC # third- internet- DNS server" >> /etc/resolv.conf

The resolver will attempt to look up an internet address using the first dns server, and when it fails (after the timeout) it will go to the next, and if that fails, it will go to the third (ie. the internet dns server)

good luck
nothing wrong with me that a few lines of code cannot fix!
Dan Hetzel
Honored Contributor

Re: Two DNS Servers

Hi Michelle,

I agree with Kofi, apart from the following fact: the first line 'domain...' is useless (I believe)

In man 4 resolver, the following is stated:
"The domain and search keywords are mutually exclusive. If more than one instance of these keywords is present, the last instance overrides."


Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Lasse Knudsen
Esteemed Contributor
Solution

Re: Two DNS Servers

I do not think Kofi is right here. If your 2 "internal" servers is not able to resolve external addresses what happens is that your machine goes to the 1st server listed in /etc/resolv.conf.

If the request fails it will *not* try the 2nd (or the 3rd) DNS server.

You need to setup your internal servers to forward queries to the "external" DNS server.
In a world without fences - who needs Gates ?
Kenneth Platz
Esteemed Contributor

Re: Two DNS Servers

Michelle,

I believe a DNS client can only query a single DNS server at a time. The only benefit to having multiple DNS servers in your /etc/resolv.conf file is that if your primary (or secondary) DNS server is down or unavailable, your system can still proceed using the secondary (or tertiary) DNS server.

You can instead configure your two internal DNS servers to forward requests that they cannot service by using the "forwarders" directive. Take a look at:

http://www.isc.org/products/BIND/docs/bog-4.9.4/bog-sh-5.html#sh-5.1.7

for additional information.

I hope this helps.
I think, therefore I am... I think!
Tim Malnati
Honored Contributor

Re: Two DNS Servers

Both Allen and Kenneth are correct. DNS will query the first server on the list, if it responds the search is done. The response can either be the info it was looking for or a signal that the information was not found. The only time the second server comes into play is if the first does not respond at all (machine down). It is the responsibility of the dns server queried to pass requests to other servers to find info that it does not have internally.

In your situation, both your primary and secondary servers need to have your 'internet' dns server as the first server on the list to query. The next two servers should be something external; the best two are probably the dns servers that your ISP provides. Your client machines should only list your primary and secondary servers.
Rob Mallard
Valued Contributor

Re: Two DNS Servers

Michelle,

I'm sorry I didn't get to answer your question in my thread below. Belene had the right answer. I'll summerize what did below:

In /etc/resolv.conf list your two internal dns servers:

nameserver primary
nameserver secondary

In the /etc/named.boot file add an entry to "forward" dns requests that can not be resovled internally to an external server

forwarders ipaddr; ipaddr

List the ipaddr twice to avoid timeout issues.

This is documented in DNS and BIND, 3rd edition on page 245

Thanks to Belene for clearing up this often mis-understood concept orignally.
jok llamera
Advisor

Re: Two DNS Servers

hi michell,

Additional info, if your using bind9, you may add it under your two internal DNS servers.

options {
directory "/var/named";
forwarders{
;
};

Thsnks,
joks
Excelence is not an act but a hobby