Linux – named-checkzone error

binddomain-name-systemlinux

I keep getting this error when I run named-checkzone example.com /var/named/example.com.zone

zone example.com/IN: NS 'ns.example.com' has no address records (A or AAAA)
zone example.com/IN: not loaded due to errors.

/etc/named.conf

options {
    directory "/var/named";
};

zone "example.com" in {
    type master;
    file "/var/named/example.com.zone";
};

/var/named/example.com.zone

$TTL 1d

example.com.    IN  SOA ns.example.com. root.example.com. (
                1   ; Serial
                3600    ; Refresh
                900 ; Update retry
                2d  ; Expire
                3600    ; TTL
                )

@   IN  NS  ns.example.com.

example.com.    IN  A   192.168.1.102
example.com.    IN  NS  ns.example.com.

What's going on here, I cant figure out why I keep getting this error.

Best Answer

You are setting your NS for this zone to ns.example.com.
But you did not create an A record for ns.example.com.

Add (adjust IP accordingly of course):
ns.example.com. IN A 192.168.1.102