Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am currently parsing a large number of zone files at my work so that we can store this data in a database and easily regenerate zone files.

I am trying to make my parser quite strict, so that we can pick up any badly formed zone files and I'm coming across some records with nothing in the 'name' field.


$TTL 120

@    NS
@    A
www  CNAME
file CNAME

How would that second A record be handled? And is it a valid syntax?

share|improve this question
Cut out the middleman and just wire your content DNS server up to the database directly. There are several content DNS server softwares that can be wired to various forms of back-end database. – JdeBP Dec 23 '11 at 21:51

1 Answer 1

up vote 2 down vote accepted

Its name is a duplicate of the previous record, so in your example, it would be a 'www' Address record. In your example, the second '@ A' record does not need the '@'.

Your example with a CNAME is invalid, as a CNAME cannot have another record with the same name. As I recall, older versions of BIND only warned about this, but newer ones won't load a zone with these errors. Other types of records are valid - that's how you add multiple addresses for names (client-based DNS round-robin), or multiple (primary, secondary, and tertiary) MX or NS records for domains, for example.

$TTL 120

@    NS
@    A
www  CNAME ; Invalid, CNAME cannot share with an A record
www  A
file CNAME ; Alias of 

What you should see in zones is similar to this:

$TTL 86400

; nameservers in another domain - must point at A records
@    NS

     ; mail hosted elsewhere - must be A records
     MX 10
     MX 20

; web farm - nameserver will return both A 
;  records when requested and client will alternate between them
www  A

; points at - in this case both CNAME (
;  and A records (, should be in the response returned.
www2 CNAME   www
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.