Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.