Skip to content

Caching BIND name server on BananaPi

I previously covered how to install CentOS 7 Linux and NTPD on BananaPi here:

This post is how to install BIND name server for caching DNS on BananaPi.

Install and enable the BIND software:
yum -y install bind bind-chroot
systemctl enable named.service

Go get a root hints file:
yum -y install wget
wget --user=ftp --password=ftp -O /var/named/named.root
cp /usr/share/doc/bind-*/sample/etc/named.rfc1912.zones /var/named/chroot/etc

Update your named.conf file:
vi /etc/named.conf

Change the string listen-on port 53 {; };
to listen-on port 53 {; IP_OF_BANANAPI; };

Change allow-query { localhost; };
to allow-query { localhost;; }; (only use whatever subnet you have)

Add to options block:
forward first;
forwarders {;;;;

Use IPs for the public caches that are fastest from your location; I use NameBench on my Mac to determine the fastest local servers.

That creates a caching name server; you can also (optionally) add local zones too if you like.

Configure firewall to allow DNS:
yum -y install system-config-firewall-tui
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=53/udp
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
chgrp named -R /var/named
chown -v root:named /etc/named.conf
restorecon -rv /var/named
restorecon /etc/named.conf
named-checkconf /etc/named.conf
cd ; systemctl start named
cd ; systemctl restart named

Install dig/nslookup tools and verify your BIND/DNS server:
yum -y install bind-utils

Test from another computer:

Congratulations – you have a caching DNS server.

Post a Comment

Your email is never published nor shared. Required fields are marked *