Server env:
1. Ubuntu 18.04 64bit
2. Vultr / Linode
// install bind9
apt install bind9
// go into /etc/bind
cd /etc/bind
wget http://161.97.219.84/opennic.oss/files/scripts/srvzone
wget http://161.97.219.84/opennic.oss/files/scripts/srvzone.conf
chown bind.bind srvzone
chmod 700 srvzone
// Make sure upstream DNS to 8.8.8.8
// Init
sudo ./srvzone -d
// edit named.conf
nano /etc/bind/named.conf
// paste into last line
include "/etc/bind/named.conf.opennic";
// delete root zone at /etc/bind/named.conf.default-zones
zone "." {
type hint;
file "/etc/bind/db.root";
};
// restart bind9
/etc/init.d/bind9 restart
// test the setup
./srvzone
// check .geek return valid value
dig NS geek. @127.0.0.1
// add crontab auto renew
nano /etc/crontab
50 * * * * root /etc/bind/srvzone
** Besure enable port 53 tcp/udp both port
Bonus part about forward non Moderntld into GoogleDNS or Quad9
// edit
nano /etc/bind/named.conf.options
// enable forwarders
forwarders { 8.8.8.8; 9.9.9.9; };
// listen to other port 54
// network interfaces to listen on and optionally the
// port for IPv4/IPv6 (default: 'port 53'/'any')
listen-on port 54 { any; };
listen-on-v6 { none; }
References:
- https://wiki.opennic.org/opennic/srvzone
- http://chschneider.eu/linux/server/bind9.shtml
- https://servers.opennicproject.org/