No current owner name error when running named-checkzone on both forward and reverse

dns-zonedomain-name-system

I'm trying to learn dns and bind on centos 7 at digital ocean. When I run named-checkzone I get the same errors. When I change around the white space I stop that error only to replace it with a 0 SOA and no NS error.

sudo named-checkzone example.com /etc/named/zones/example.com.zone
/etc/named/zones/example.com.zone:1: no current owner name
/etc/named/zones/example.com.zone:2: no current owner name
/etc/named/zones/example.com.zone:3: no current owner name
/etc/named/zones/example.com.zone:16: no current owner name
/etc/named/zones/example.com.zone:17: no current owner name
/etc/named/zones/example.com.zone:18: no current owner name
/etc/named/zones/example.com.zone:19: no current owner name
/etc/named/zones/example.com.zone:24: no current owner name
/etc/named/zones/example.com.zone:25: no current owner name
/etc/named/zones/example.com.zone:26: no current owner name
/etc/named/zones/example.com.zone:27: no current owner name
/etc/named/zones/example.com.zone:28: no current owner name
/etc/named/zones/example.com.zone:29: no current owner name  

$ORIGIN example.com.
$TTL 14400
@    IN    SOA    ns1.example.com.    hostmaster.example.com. (
2014071301 ; serial.  date.    today + increment
3600       ; refresh. seconds. frequency slave refreshes from master.
600        ; retry.   seconds. frequency slave retries master after failure.
604800     ; expire.  seconds. slave stops responding as authoritative.
86400      ; ttl.     seconds. Maximum caching time by resolver.
)

;------------------------------------------------------------------------------
; Special Records
;
; Note: SPF Records are limited to 10 DNS lookups recursively.
;
IN NS    ns1.example.com.
IN NS    ns2.example.com.
IN MX    10   mail.example.com.
IN TXT  "v=spf1 -ALL"

;------------------------------------------------------------------------------
; Main Records
;
@           IN A    192.0.2.1
*           IN A    192.0.2.1
ns1         IN A    192.0.2.2
ns2         IN A    192.0.2.3
mail        IN A    192.0.2.1
www         IN A   192.0.2.1

Same thing with the reverse called db.192.0

$ORIGIN  2.0.192.in-addr.arpa.
$TTL 86400

@      IN      SOA     ns1.example.com.        hostmaster.example.com. (
3 ; serial
21600      ; refresh after 6 hours
3600       ; retry after 1 hour
604800     ; expire after 1 week
86400 )    ; minimum TTL of 1 day

@  IN  NS     ns1.example.com.
2             IN      PTR     ns1.example.com.
3             IN      PTR     ns2.example.com.

Best Answer

As Julie Pelletier already commented, remove the leading white spaces in your zone records, as they hold a special meaning in Bind zone files.

By starting a line with a white space (which is neither a hostname, the zone name or the @ shorthand for the zone origin) that line becomes a continuation of the record above it.

$ORIGIN neilanuskiewicz.com.
$TTL 14400
 @    IN    SOA    ns1.neilanuskiewicz.com.   ...

That makes the line with the SOA record a continuation of the none existent record above it (the variables don't count in that regard) and hence your failure; there is resource record above it, no owner to apply that continuation record to.

$ORIGIN neilanuskiewicz.com.
$TTL 14400
@    IN    SOA    ns1.neilanuskiewicz.com.   ...

You can intentionally use lines starting with a white space to though:

@                    IN  A     192.0.2.1       ; IPv4 address for the bare domain using the @ short hand
neilanuskiewicz.com. IN  AAAA  2001:db8:10::1  ; IPv6 address for the bare domain
www                  IN  A     192.0.2.1            
                     IN  AAAA  2001:db8:10::1  ; IPv6 address for www using DNS shorthand by starting this line with a space