This zone file format has records in the following form:
name [+ttl] [rtype] rdataThe name is the name of the record we will add, such as "www.example.net.". This must be placed at the beginning of a line. The rtype is the record type for the record, such as "A" (ipv4 IP address), "MX" (mail exchanger), or "AAAA" (ipv6 IP address). The ttl is how long other DNS servers should store this data in their memory (in seconds); this field needs a '+' as its initial character. The rdata is the actual data for this record; the format for the rdata is type-specific.
Anything in square brackets is an optional field. If the ttl is not specified, the ttl is set to be 86400 seconds long (one day). If the rtype is not specified, it is set to be an "A" (ipv4 address) record.
The zone file supports comments; comments are specified by having a '#' anywhere between fields or records; when a '#' is seen, the csv2 parser ignores any character it sees (with the exception of the '{' character, which is not currently allowed in csv2 zone files) until a newline. A '#' can usually be placed inside a field, and indicates the end of a field when placed there.
The following record types are supported; a description of the record data format accommodates the record type:
a.example.net. 10.11.12.13 b.example.net. A 10.11.12.14 c.example.net. +64000 A 10.11.12.15
13.12.11.10.in-addr.arpa. PTR a.example.net. 14.12.11.10.in-addr.arpa. PTR b.example.net. 15.12.11.10.in-addr.arpa. +64000 PTR c.example.net.
example.net. MX 10 mail.example.net. mail.example.net. 10.11.12.16
a.example.net. AAAA 3ffe:ffff:ffe:501:ffff::b:c:d
_http._tcp.% srv 0 0 80 a.%
example.net. NS ns1.example.net. example.net. NS ns2.example.net.
x.org. SOA x.org. email@x.org. 1 7200 3600 604800 1800
A basic text record can be stored by placing ASCII data between two single quotes, as follows:
example.com. TXT 'This is an example text field'Any binary data can be specified; see the csv2_txt(5) manual page for full details.
RAW [numeric rtype] [data]The numeric rtype is a decimal number.
The data field can, among other thing, have backslashed hex sequences outside of quotes, concatenated by ASCII data inside quotes, such as the following example:
example.com. RAW 40 \x10\x01\x02'Kitchen sink'\x40' data'The above example is a "Kitchen Sink" RR with a "meaning" of 16, a "coding" of 1, a "subcoding" of 2, and a data string of "Kitchen sink@ data" (since hex code 40 corresponds to a @ in ASCII). Note that unquoted hex sequences are concatenated with quoted ASCII data, and that spaces are only inside quoted data.
The format for a data field in a RAW record is almost identical to the format for a TXT data field. Both formats are described in full in the csv2_txt(5) manual page.
# This is an example csv2 zone file # First of all, csv2 zone files do not need an SOA record; however, if # one is provided, we will make it the SOA record for our zone # The SOA record needs to be the first record in the zone if provided #% SOA % email@% 1 7200 3600 604800 1800 # Second of all, csv2 zone files do not need authoritative NS records. # If they aren't there, MaraDNS will synthesize them, based on the IP # addresses MaraDNS is bound to. (She's pretty smart about this; if # Mara is bound to both public and private IPs, only the public IPs will # be synthesized as NS records) #% NS a.% #% NS b.% # Here are some A (ipv4 address) records; since this is the most # common field, the zone file format allows a compact representation # of it. a.example.net. 10.10.10.10 b.example.net. 10.10.10.11 b.example.net. 10.10.10.12 # We can have the label in either case; it makes no difference Z.EXAMPLE.NET. 10.2.3.4 Y.EXAMPLE.net. 10.3.4.5 # We can use the percent shortcut. When the percent shortcut is present, # it indicates that the name in question should terminate with the name # of the zone we are processing. percent.% a 10.9.8.7 # And we can have star records #*.example.net. A 10.11.12.13 # We can have a ttl in a record; however the ttl needs a '+' before it: # Note that the ttl has to be in seconds, and is before the RTYPE d.example.net. +86400 A 10.11.12.13 f.example.net. # As you can see, records can span multiple lines A 10.2.19.83 # This allows well-commented records, like this: c.example.net. # Our C class machine +86400 # This record is stored for one day A # A record 10.1.1.1 # Where we are # We can even have something similiar to csv1 if we want... e.example.net.|+86400|a|10.2.3.4 h.example.net.|a|10.9.8.7 # Here, we see we can specify the ttl but not the rtype if desired g.example.net.|+86400|10.11.9.8 # Here is a MX record % mx 10 mail.% mail.% +86400 IN A 10.22.23.24 # We even have a bit of ipv6 support a.example.net. aaaa 3ffe:ffff:1:2:3::4:f # Not to mention support for SRV records _http._tcp.% srv 0 0 80 a.% # And, of course, TXT records example.net. txt 'This is some text'