Zone file

from Wikipedia, the free encyclopedia

A zone file is part of the configuration of the BIND name server for the Domain Name System . It consists of a list of resource records (RR). A zone file completely describes a zone . 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 for the individual RR types, the RFC standards define various global syntax rules . The main goal of these global rules is to improve the readability of zone files. A syntax error usually results in the entire zone file being considered unusable. The name server then behaves similarly as if this zone did not even exist. It responds to DNS queries with a SERVFAIL error message (if the zone does not actually exist, it responds with NXDOMAIN).

regulate

Rule 1 - blank lines

Empty lines are allowed.

Rule 2 - Comments

Comments are introduced by ;(semicolon). Anything that ;appears to the right of you counts as a comment. Comments are not transferred with the zone transfer.

Rule 3 - multi-line instructions

If a resource record is to be distributed over several lines, brackets must be used.

Example:

     example.com. 1800  IN  SOA  ns1.example.com. mailbox.example.com. (
                                                100   ; Seriennummer
                                                300   ; Refresh Time
                                                100   ; Retry Time
                                                6000  ; Expire Time
                                                600   ; negative Caching Zeit
                                               )
     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 placeholder for zone names

If the name of the zone - the so-called Origin - appears in isolation without an extension, it can be replaced by a " @".

Example file example.com:

     @                  1800  IN  SOA ns1.example.com. mailbox.example.com. (
                                                100   ; Seriennummer
                                                300   ; Refresh Time
                                                100   ; Retry Time
                                                6000  ; Expire Time
                                                600   ; negative Caching Zeit
                                               )
     @                  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

If the origin (name of the zones) appears at the end of a name, it can be omitted. Note the difference caused by the omitted period at the end of the name: names with a period attached are fully qualified, and names without a period are always relative to the origin, as you can see in the last two examples.

Example zone example.com :

     @                  1800  IN  SOA ns1 mailbox (
                                                100   ; Seriennummer
                                                300   ; Refresh Time
                                                100   ; Retry Time
                                                6000  ; Expire Time
                                                600   ; negative Caching Zeit
                                               )
     @                  1800  IN  NS ns1
     ns1                1800  IN  A  172.27.182.17
     www 1800  IN  A  192.168.1.2
     www.abteilung 1800  IN  A  192.168.1.3      ; bedeutet www.abteilung.example.com
     www.example.com 1800  IN  A  192.168.1.4      ; bedeutet wegen fehlenden Punkts www.example.com.example.com

Rule 6 - only the first name has to be given

If two or more consecutive RRs have the same name, only the first needs 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" only needs to be specified once

The class field “ IN” only needs to be specified for the first RR.

Example:

     @                  1800  IN  SOA ns1 mailbox (
                                                100   ; Seriennummer
                                                300   ; Refresh Time
                                                100   ; Retry Time
                                                6000  ; Expire Time
                                                600   ; negative Caching Zeit
                                               )
                        1800   NS ns1          ; der Name darf weggelassen werden
     ns1                1800   A   172.27.182.17
     www 1800   A   192.168.1.2

Rule 8 - TTL

If there is no TTL ( time to live ) in an RR , the value is taken from the $ TTL variable at the beginning of the zone file before the SOA resource record . Before Bind Version 8.2, this TTL value came from the last field in the SOA Resource Record (minimum TTL), which was replaced by the "negative caching TTL" from Bind Version 8.2 and the $ TTL was introduced in its place before the SOA-RR .

Example:

     $TTL 1234
     @              IN  SOA  ns1 mailbox 100 300 100 6000 10800
                        NS   ns1
     ns1                A    172.27.182.17     ; TTL=1234 aus $TTL
     www 20        A    192.168.1.2       ; nur hier gilt TTL=20
     test A    1.2.3.4           ; TTL=1234 aus $TTL

The unit for time information such as B. TTL is seconds (see Ripe-203). The specification of the TTL field can be found in RFC 2308.

Rule 9 - $ ORIGIN

The default origin is the zone name as defined in the named.conf.local file . $ORIGINAny other origins can be defined with the instruction. A newly defined origin is $ORIGINvalid for all following lines up to the next statement.

Example zone example.com :

     $TTL = 1234
     @        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

$TTLA default TTL value can be specified with the instruction.

Example:

     $TTL 1800
     @        IN  SOA  ns1 mailbox 100 300 100 6000 600
                  NS   ns1
     ns1          A    172.27.182.17

Rule 11 - $ INCLUDE

$INCLUDEAdditional files can be integrated with instructions. Of course, these must have the correct syntax. The $INCLUDEstatement has only local meaning. During the 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/a-records.txt

Others

The well-known BIND name server also has the $GENERATEinstruction with which resource records can be generated automatically.

Web links

Individual evidence

  1. ^ Peter Koch: Recommendations for DNS SOA Values. RIPE DNS Working Group, June 1999, accessed April 15, 2013 .
  2. ^ Mark Andrews:  RFC 2308 . - Negative caching of DNS queries (DNS NCACHE) . March 1998. (English).