How can I forward queries from a DNS to another depending on the IP address?

1

I set two DNS servers using bind9 which recieve queries from other PCs on a LAN. Both pc's have their own domain and so far I managed to make the main server redirect queries to the backup one if they request for a domain that is not in it. Now, the last thing I have to do is to respond to queries from different servers depending on the client's IP address.

I have two lists containing ip addresses that are on my LAN: Linuxes and VPCS

I need to make the main DNS server respond to queries from Linuxes, and the backup server to respond to queries coming from VPCS. Whenever I test it I'm querying a domain that is in the main DNS server, regardless of the list the PC is in. So, I pretty much have to redirect the query to another domain if the client IP address is in the VPCS list. I've been using views and I was successfull in filtering the queries but I still can't redirect them to the other server. I also tried to create another zone but it didn't work.

Main DNS server's ip address is 192.168.1.14 . Backup DNS server's ip address is 192.168.2.3 . I'm simulating the entire LAN on gns3 using 2 cisco routers, I've checked them and the settings are ok, so I doubt they're the culprit.

This is my named.conf.local

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
include "/etc/bind/named.conf.options";

view "vpcs"{
    match-clients{vpcs;};
    forwarders {
        192.168.1.14;
        192.168.2.3;
    };
#   forward only;
#   recursion yes;
    zone"zonaP.gg" in {
        type master;
        file "/etc/bind/for.zonaP.gg";
        masterfile-format text;
    };

    zone "168.192.in-addr.arpa" in {
        type master;
        file "/etc/bind/rev.zonaP.gg";
        masterfile-format text;

    };  

};

view "linuxes"{
    match-clients{any;};
    zone "zonaP.gg" in {
        type master;
        file "/etc/bind/for.zonaP.gg";
        masterfile-format text;
    };

    zone "168.192.in-addr.arpa" in {
        type master;
        file "/etc/bind/rev.zonaP.gg";
        masterfile-format text;
    };
};

And this is my named.conf.options

acl linuxes {
    192.168.1.11;
    192.168.1.3;
    192.168.1.14;
    192.168.2.4;
    192.168.2.3;
    192.168.1.19;
    192.168.1.20;
};

acl vpcs {
    192.168.1.10;
    192.168.1.11;
    192.168.1.12;
    192.168.1.2;
    192.168.1.4;
    192.168.1.13;
    192.168.1.15;
    192.168.2.2;
    192.168.3.2;
};

options {
    directory "/var/cache/bind";
    recursion yes;
    allow-query {any;};
    allow-query-cache {any;};
    forwarders{192.168.2.3;};
    dnssec-validation auto;
    auth-nxdomain no;
    listen-on-v6 { any; };
};

George Gibbs

Posted 2018-12-10T08:33:41.693

Reputation: 11

No answers