DNS Forwarders based on Source IP Addresses(Bind 9)

binddomain-name-system

Sites A,B —> Site C (Win2012R2 DNS Server) –> forwards external DNS queries to our "BIND Server" (where DNS forwarders are set) when surfing the Net.

Our clients in both Site A and Site B relies on Site C's DNS server for internal DNS resolution.
Since Site A and Site B are from different places, I would like to have separate DNS forwarders based on IP addresses of Sites A and B, which are then to be set in the Bind Server to improve the performance.

Is it possible to achieve that? Or are there any workarounds?

Best Answer

I am not familiar with Win2012R2 DNS Server but with Bind9 you can achieve what you want pretty easily with Bind9 acl + views

Define two acl to match each site based on source address

acl siteA {
    10.1.1.0/24;
    fde1::/64;
};

acl siteB {
    10.2.2.0/24;
    fde2::/64;;
};

Then define two views based on acl and for each view define forwarders you want

view "siteA" {
    match-clients {
        siteA;
    };
    recursion no;
    forwarders {
      8.8.8.8
      2001:4860:4860::8888
    };
};

view "siteB" {
    match-clients {
        siteB;
    };
    recursion no;
    forwarders {
      8.8.4.4
      2001:4860:4860::8844
    };
};

This setup works perfectly, usually relevant for internal / external zones. For example allow recursion for internal clients and act as authoritative name server for external clients