0

I was wondering if there's any method to configure BIND server to answer queries based on the record's local value and if it's not there, forward the request to the configured recursive server.

Example

test.com is saved in the local BIND DB file as

...
x      A  1.2.3.4
...

and on the "public" DNS as

...
x      A  5.6.7.8
y      A  2.0.0.2
...

If I ask for x I want to get the answer 1.2.3.4 but if I ask for y I want my server to respond with 2.0.0.2.

This is the functionality included with dnsmasq when you add hosts to the /etc/hosts file but I'd like to know if:

  1. BIND can do this or...
  2. ...there's any other DNS server that can do that.
1

If I understand you correctly you need to use view

acl "local_network" {
      192.168.0.0/16;
      127.0.0.0/8;
};

...

view "internal" in {

    match-clients { local_network; };
    recursion yes;
    additional-from-auth yes;
    additional-from-cache yes;

    zone "." in {
        type hint;
        file "named.root";
    };

    zone "test.com" IN {
        type master;
        file "master/test.com_int";
        allow-query { local_network; };
        allow-transfer { none; };
        allow-update { none; };
    };
...
}

view "external" in {

    match-clients { !local_network; any; };
    recursion no;

    zone "test.com" IN {
        type master;
        file "master/test.com_ext";
        allow-query { all; };
        allow-transfer { none; };
        allow-update { none; };
    };
...
};
  • Well, probably there's a problem with my example. I'll try with another one: imagine you're connected to a company's LAN and they want to redirect some of your traffic to a local IP (let's say www.company.com -> 10.0.1.240 instead of 88.73.123.123) but for other subdomains like mail.company.com just take the address set in the official DNS for company.com. In this case they want to setup a DNS proxy between you and the Internet to filter some DNS queries, but not every query for *.company.com. – ipersite Oct 6 '13 at 8:55
  • As far as I know, it's not possible. You need to create separate zone for each domain name. Are the subdomains need to exist for both of "area" - internal and external? – ALex_hha Oct 6 '13 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.