LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-30-2009, 06:19 AM   #1
xtc
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
Choosing DNS server based on domain being queried


Hi,

I've setup a BIND 9 server that sits in multiple subnets and serves different views based on which subnet the query came from. This is working fine.

Now I have a Debian client that sits in two of these subnets and I'd like it to choose which DNS server IP to use based on the domain name in the query, i.e. host.domain would be looked up using DNS server defined for the first network interface, whereas host.foobar.domain would use a different DNS server defined for the second network interface. How should I go about doing this? Resolvconf apparently lets you define dns-nameservers and dns-servers on a per-interface basis, but I can't find any good documentation about how this actually works.
 
Old 09-30-2009, 10:16 AM   #2
abarclay
LQ Newbie
 
Registered: Aug 2003
Posts: 25

Rep: Reputation: 5
I don't believe there is any way to do what you want using only the resolv.conf. I think the easiest solution is to run a caching only name server on your Debian client, then point your client to itself, then use selective forwarding to forward the query to the correct name server.

You'd need to put the following in your named.conf

zone "domain" IN {
type forward;
forwarders {10.0.0.1;};
};

zone "foobar.domain" IN {
type forward;
forwarders {10.0.1.1;};
};

Alternatively, you could setup both your existing name servers to forward queries to each other.

Hope this helps,
Andy
 
Old 10-01-2009, 06:01 AM   #3
xtc
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, that solution worked perfectly.

I wonder though if this could have been done using resolvconf package (not resolv.conf file). If you define dns-nameservers and dns-search for an interface using resolvconf, does it automatically know to look for those domains using that interface, or does it simply try appending those suffixes as with resolv.conf search option? In the latter case, how does resolvconf decide which interface to use for sending the queries?
 
Old 10-01-2009, 10:21 AM   #4
abarclay
LQ Newbie
 
Registered: Aug 2003
Posts: 25

Rep: Reputation: 5
I just did some research on the resolvconf package as I was not familiar with it.
There is some information here:
http://en.wikipedia.org/wiki/Resolvconf
and the man page is here:
http://www.clab.it/cgi-bin/man/man2html?resolvconf+8

It appears that the sole purpose of that program is to re-write the resolv.conf based on what interfaces are present on your computer, so this would NOT work for your situation. The only thing that resolvconf would do is deal with situations when you have multiple programs that tend to configure resolv.conf - perhaps you run two dhcpclient programs (one for each interface) and perhaps you also have ppp running to support your connection to the Internet.

The only configuration for resolvconf seems to be the interface-order file. If you look at the man page here:
http://www.clab.it/cgi-bin/man/man2h...nterface-order

You can see that it only supports interface name and not domain name in order to choose which name server to use.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS server for new domain helpmhost Linux - Networking 2 08-07-2009 03:28 PM
I have only one domain, do i need DNS Server? demia Linux - Server 5 05-04-2009 04:27 PM
DNS Server Web based tool ? talat Linux - Server 4 04-19-2007 08:41 AM
Traceroute, Ping, Domain Name Server (DNS) Lookup, WHOIS, and DNS Records Lookup netoknet General 1 05-09-2005 03:43 AM
DNS getting queried everytime I open a program Zil Linux - Networking 5 03-14-2002 02:47 PM


All times are GMT -5. The time now is 01:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration