Centos – BIND DNS Server failed

bindcentos

I got this error on Centos. How to solve the problem?

named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-07-12 12:01:00 EDT; 15s ago
Process: 4728 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z /etc/named.conf; else echo "Checking of zone files is disabled"; fi (code=exited, status=1/FAILURE)

Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ns1.ringochat.com/IN: loaded serial 2013071600
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ns2.ringochat.com/IN: loaded serial 2013071600
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ringochat.com/IN: NS 'ns1.ringochat.com' has no address records (A or AAAA)
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ringochat.com/IN: NS 'ns2.ringochat.com' has no address records (A or AAAA)
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ringochat.com/IN: not loaded due to errors.
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: _default/ringochat.com/IN: bad zone
Jul 12 12:01:00 ns1.ringochat.com systemd[1]: named.service: control process exited, code=exited status=1
Jul 12 12:01:00 ns1.ringochat.com systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Jul 12 12:01:00 ns1.ringochat.com systemd[1]: Unit named.service entered failed state.
Jul 12 12:01:00 ns1.ringochat.com systemd[1]: named.service failed.

Best Answer

The error tells you - you have no A records for your name servers. This means you are probably hosting your own primary and secondary name servers, so you'll need glue records as well.

Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ringochat.com/IN: NS 'ns1.ringochat.com' has no address records (A or AAAA)
Jul 12 12:01:00 ns1.ringochat.com bash[4728]: zone ringochat.com/IN: NS 'ns2.ringochat.com' has no address records (A or AAAA)

In your zone file, you need to add something like

ns1.ringochat.com.  IN   A  192.168.123.231
ns2.ringochat.com.  IN   A  192.168.123.232

and then check the zonefile with

named-checkzone ringochat.com /path/to/zonefile

If it reports loading OK (with maybe a "out of zone info ignored" for your glue record servers) then edit again, increase your serial, and restart bind.