Score:0

Configure Bind9 to forward for a zone and reject all other requests

vn flag

I have an interesting use case where my hosting providers (Heroku) DNS has intermittent issues resolving a certain subdomain.

They have an option that allows you to insert a custom resolver as the primary lookup mechanism and then any failed requests will fallback to their DNS.

How might I setup a bind9 server to forward requests to 8.8.8.8 for one subdomain only? And all other requests need to fail, causing the client to use the secondary nameserver (which I don't know the IP of).

My first attempt was to add the zone and specify the forwarder;

zone "a-test.subdomain.com" {
    type forward;
    forwarders {
        8.8.8.8;
    };
};

And then setting

recursion no;
allow-query { any; };

But it results in

query failed (REFUSED) for a-test.subdomain.com/IN/A at query.c:5665
Score:0
cu flag

Inside the configuration file BIND9, locate the options section and add or modify the following lines:

options {
    recursion yes;
    allow-query { any; };
};

Below the options section, add the following lines:

view "forward-view" {
    match-clients { any; };
    recursion no;

    zone "a-test.subdomain.com" {
        type forward;
        forward only;
        forwarders {
            8.8.8.8;
        };
    };
};

view "fallback-view" {
    match-clients { any; };
    recursion no;

    // Add your secondary nameserver's IP address here
    // Replace 192.0.2.2 with the actual IP address
    zone "." IN {
        type forward;
        forwarders {
            192.0.2.2;
        };
    };
};

Save the changes and restart the BIND9 service to apply the new configuration.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.