BIND: Redirect all lookups to a different nameserver using NS

binddomain-name-systeminternal-dnsnameserver

I'm creating a dns server for a local network, and I need to do redirection based on the domains. Also, i'm fairly new to DNS.

I have to redirect all "ia.in" domains to a different local nameserver (172.31.1.30) which already contains their entries, and all others to any external nameserver (currently i'm trying to use Google's 8.8.4.4).

I tried using forwarders, and they worked, but the DNS server is an old, slow system, so I thought it'd be better if I could use NS entries, so that the forwarding load mainly falls onto the client's side.

With the NS entries, it gives a servfail when I try to ping either any "ia.in" domain, or any external domain. Here are the relevant named.conf and zone file entries:

named.conf

zone "." IN {
    type master;
    file "out.redirect";
    allow-transfer { any; };
};

zone "ia.in" IN {
    type master;
    file "ia.zone";
    allow-transfer { any; };
//  The entries below worked
//  type forward;
//  forwarders { 172.31.1.30; };
};

out.redirect

$ORIGIN .
$TTL 1D
@       IN      SOA @ none. ( 0 1D 1H 1W 3H );
* IN NS 8.8.4.4

ia.zone

$ORIGIN ia.in.
$TTL 1D
@       IN      SOA @ none. ( 0 1D 1H 1W 3H );
ia.in IN NS 172.31.1.30

What should I change in my configuration so that this works?

Best Answer

You can't do that. What you currently do is create new authoritative zones. It will redirect nothing nothere. Besides you probably shouldn't - DNS loads is probably negligible.