0

I have a DNS server using BIND9 on Ubuntu 18.04 server, It acts as caching DNS server as well as local resolver for local network IPs.

This server forwards to Google DNS 8.8.8.8, 8.8.4.4.

I was wondering if it's possible to forward specific DNS request let's say www.foo.bar to another DNS server say 1.1.1.1 instead.

1 Answer 1

3

Use type forward zone:

zone "example.com" IN {
        type forward;
        forwarders { 192.168.1.2; 192.168.1.254; };
};

zone "1.168.192.in-addr.arpa" IN {
        type forward;
        forwarders { 192.168.1.2; 192.168.1.254; };
};

http://www.zytrax.com/books/dns/ch7/zone.html#type

4
  • The URL is the zone name ? Oct 30, 2019 at 12:50
  • You asked for redirecting "specific DNS request". You didn't ask for "URL". And, that is impossible to resolve names based on anything beyond the sole domain name (port number, path and so on). Or I don't understand what do you mean by this comment. Oct 30, 2019 at 12:58
  • Allow me to rephrase, the Domain which I am trying to resolve must be the zone name? Oct 30, 2019 at 14:15
  • If you want to do this with BIND, it seems yes, the only way to "replace" one hostname resolution is to configure it as if it is a distinct zone. Other servers could do other way, for example, dnsmasq simply reads local hosts and serves them, so for it you'll only need to add another entry into hosts file. Oct 31, 2019 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .