20

In dnsmasq, it's possible to forward domains to different nameservers. How can I do that in named?

server=/foo.com/10.0.10.1
server=/vpn.foo.com/8.8.8.8
Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
Cheng
  • 6,531
  • 11
  • 40
  • 42

1 Answers1

23

This should work for BIND9:

zone "foo.com" IN {
    type forward;
    forwarders {
        10.0.10.1;
    };
};

zone "vpn.foo.com" IN {
    type forward;
    forwarders {
        8.8.8.8;
    };
};
James Sneeringer
  • 2,512
  • 13
  • 14
  • 1
    You might also need to replace `dnssec-validation auto;` with `dnssec-validation no;` in named.conf.options. – mivk Dec 30 '13 at 17:12
  • 1
    Does this also supports wildcards? – petersaints Aug 24 '15 at 18:52
  • The [BIND 9.9 Configuration Reference](http://ftp.isc.org/isc/bind9/cur/9.9/doc/arm/Bv9ARM.ch06.html) doesn't explicitly say, but since the zone name needs to be a valid zone that could be used with the `$ORIGIN` directive in a zone file, I don't believe you can use wildcards for the zone name. – James Sneeringer Aug 24 '15 at 19:22
  • 3
    Also a `forward only` option might be meaningful here. – Dima Chubarov Nov 09 '16 at 07:48