Configure BIND to prefer IPv4 without disabling IPv6

bindipv4ipv6

Our office network is internally dual-stack, but the connection to the rest of the Internet is IPv4-only. I've got BIND 9.9 set up on a Linux box to handle DNS resolution.

Is there a way to configure BIND to prefer to use IPv4 when contacting other DNS servers without disabling IPv6? I'd like to leave IPv6 enabled so everything Just Works once we get an IPv6 connection to the outside world, but without clogging the logs with error (network unreachable) resolving 'microsoft.com/DS/IN': 2001:7fd::1#53 messages in the meantime.

Best Answer

Can't remember where I found this solution, but here it is

In /etc/bind/named.conf.local:

// disable lookup over IPv6
server ::/0 {
        bogus yes;
};

It then pretends that IP addresses in the IPv6 range are non reachable and does it with IPv4 instead.