Zone file
A zone file is part of the configuration of the name server BIND for the Domain Name System. It consists of a list of resource records (RR). A zone file describes a zone completely. There must be exactly one SOA resource record and at least one NS resource record. The SOA RR is usually located at the beginning of a zone file.
In addition to the syntax rules of the individual RR types the RFC standards define various global syntax rules. The main objective of this global rules is to improve the readability of zone files. A syntax error usually leads to the fact that the entire zone file is considered unusable. The name server will then behave similarly, as would be non-existent this zone. On DNS queries it responds with a SERVFAIL error message ( if the zone is not actually present, it responds with NXDOMAIN ).
Regulate
Rule 1 - blank lines
Blank lines are allowed.
Rule 2 - Comments
Comments are; initiated (semicolon) " ". Everything to the right by a ";" appears, considered as a comment. Comments are not transferred during zone transfer.
Rule 3 - multiline statements
If a resource record will be spread over several lines, so brackets must be used.
Example:
Example.com. 1800 IN SOA ns1.example.com. mailbox.example.com. ( 100; serial number 300; Refresh Time 100; Retry Time 6000; Expire Time 600; negative caching time ) example.com. 1800 IN NS ns1.example.com. ns1.example.com. 1800 IN A 172.27.182.17 ns1.example.com. 1800 IN AAAA 2001: db8 :: f: a www.example.com. 1800 IN A 192.168.1.2 www.example.com. 1800 IN AAAA 2001: db8 :: 1:2 Rule 4 - @ as a wildcard for zone name
When the name of the zone - the so-called Origin - without extension insulated, so they may be replaced by an "@".
Sample file example.com:
@ 1800 IN SOA ns1.example.com. mailbox.beispiel.de. ( 100; serial number 300; Refresh Time 100; Retry Time 6000; Expire Time 600; negative caching time ) @ 1800 IN NS ns1.example.com. @ 1800 IN A 1.2.3.4 @ 1800 IN AAAA 2001: db8 :: 1:2:3:4 alias.example.com. 1800 IN CNAME @ ns1.example.com. 1800 IN A 172.27.182.17 ns1.example.com. 1800 IN AAAA 2001: db8 :: 53 www.example.com. 1800 IN A 192.168.1.2 www.example.com. 1800 IN AAAA FD00 :: 1:2 Rule 5 - zone name can be omitted
Appears the Origin (name of area) at the end of a name, he may be omitted. Note the difference which arises due to the omitted point at the end of the name: the name with an attached point are fully qualified, and registered no points are relative to the origin, as can be seen in the last two examples.
Example zone example.com:
@ 1800 IN SOA ns1 mailbox ( 100; serial number 300; Refresh Time 100; Retry Time 6000; Expire Time 600; negative caching time ) @ 1800 IN NS ns1 ns1 IN A 172.27.182.17 1800 www IN A 192.168.1.2 1800 www.abteilung 1800 IN A 192.168.1.3; means www.abteilung.example.com 1800 IN A 192.168.1.4 www.example.com; means due to lack of point www.example.com.example.com Rule 6 - only the first name must be specified
If two or more consecutive RRs with the same name, then it only the first to be specified.
Ns1.example.com. 1800 IN A 172.27.182.17 1800 IN AAAA 2001: db8 :: 53 www.example.com. 1800 IN A 192.168.1.2 1800 IN AAAA FD00 :: 1:2 Rule 7 - "IN" must be specified only once
The class field "IN" only needs to be specified at the first RR.
Example:
@ 1800 IN SOA ns1 mailbox ( 100; serial number 300; Refresh Time 100; Retry Time 6000; Expire Time 600; negative caching time ) 1800 NS ns1; the name may be omitted ns1 1800 A 172.27.182.17 www 1800 A 192.168.1.2 Rule 8 - TTL
If a RR is not a TTL (time to live) is present, the last in the zone file is used previously existing TTL value. If no previous TTL present, then the value from the SOA resource record is taken.
Example:
@ IN SOA ns1 mailbox 100 300 100 6000 1234 NS ns1; = 1234 from SOA ns1 A 172.27.182.17; TTL = 1234 from SOA www 20 A 192.168.1.2; From here applies TTL = 20 A test 1.2.3.4; TTL = 20 from previous entry The unit for time values such as TTL is seconds ( seen in Ripe- 203)
Rule 9 - $ ORIGIN
Standard Origin is the zone name as it was defined in the file named.conf.local. With the $ ORIGIN directive any other Origins can be defined. A newly defined Origin is valid for all following lines up to the next $ ORIGIN directive.
Example zone example.com:
@ IN SOA ns1 mailbox 100 300 100 6000 1800 NS ns1 ns1 A 172.27.182.17 www A 192.168.1.2 $ ORIGIN sub.example.com. xxx A 1.2.3.4 Rule 10 - $ TTL
With the $ TTL statement, a default TTL value can be specified.
Example:
$ TTL 1800 @ IN SOA ns1 mailbox 100 300 100 6000 600 NS ns1 ns1 A 172.27.182.17 Rule 11 - $ INCLUDE
With $ INCLUDE statements other files can be integrated. This course must have a correct syntax. The $ INCLUDE statement has local significance only. When a zone transfer, the expanded zone is transferred.
Example:
@ IN SOA ns1 mailbox 100 300 100 6000 1800 NS ns1 ns1 A 172.27.182.17 $ INCLUDE / var / named / mx- records.txt $ INCLUDE / var / named / O records.txt Others
In the known BIND name server also exists the $ GENERATE statement, records can be automatically generated with the resource.