Configure BIND 9 For IPv4 (or IPv6) Only
I’m running a slave DNS server on the machine that runs this website. It is one of three DNS servers (one master, two slaves) that I have running for my multiple domains. I recently noticed from my Logwatch output that it was having issues with IPv6 lookups and these were causing timeouts and putting extra notices in my log files. I decided the best route would be to just turn off IPv6 in BIND altogether.
Configuring named
The named man page (man named) lists two options for supporting IPv4 or IPv6. Each of these commands are mutually exclusive, meaning using one of the options will not allow you to use the other. Either IPv4 or iPv6, not both. Now the default is to use both, so if you want to continue supporting lookups on IPv4 and IPv6 there is nothing more you need to do. If you want to *only* use one or the other you can use the -4 or -6 options in the configuration.
IPv4 only (/etc/default/bind9):
# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS="-4 -u bind"
IPv6 only (/etc/default/bind9):
# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS="-6 -u bind"
Once you have updated this file and defined the option you want, you’ll simply need to restart the BIND service and it’ll start listening on or or the other but, again, not both.
sudo /etc/init.d/bind9 restart
My BIND installation is now listening on only IPv4 and I have yet to see the same slowdown or amount of log output that I used to. I guess, when we start using IPv6 one of these days I’ll need to change it, but I don’t have a lot of faith in that happening anytime soon.