Checking bind config & restarting service

I was using bind installed as DNS server in home lab and as I was doing multiple modification, I wanted to if I made any mistake in my configuration, so I made below little script which is supper easy to read and modify; it’ll just show where (which file) issue exist instead of checking manually each time or checking in log files for error.


One can simple modify template scope I’ve placed here or add new scopes.
Change DOMAIN, with your domain and then fw.domain.db with the file responsible for forward lookup zone; same for rev-IP which is reverse of network IP and rev.domain.db which is the one responsible for reverse lookup zone.
Last line is the bind file itself which will restart the service.

# ver 0.1

if (named-checkconf)
  then
    echo "Config is good."
  else
    echo "There's an issue with config."
fi

echo
named-checkzone DOMAIN /etc/bind/zones/master/fw.domain.db

echo
named-checkzone rev-IP.in-addr.arpa /etc/bind/master/rev.domain.db

echo
/etc/init.d/bind9 restart

For more information about forward and reverse zone you can check below links:

It's your kindness to leave a reply/feedback