Background

Zone file directives are control entries that affect the rest of the zone file. There are three directives that have been standarized in RFC 1035 and RFC 2038: $TTL, $ORIGIN and $INCLUDE. A forth directive, $GENERATE is supported by BIND but has not yet been standarized.



$TTL Directive

Every Resource Record (RR) may take an optional Time to Live (TTL) value specified in seconds. The $TTL directive was standarized in RFC 2038 and defines the default TTL value applied to any RR that does not have an explicit TTL defined. TTL in the context of DNS means the time in seconds that a record may be cached by another name server or in some cases a resolver. The $TTL directive must appear at the top of the Zone file before the SOA record.

$TTL Syntax

$TTL time-in-seconds

$TTL Example

Snippets from a fictitious 'yourdomain.com' domain zone file
;
;   Database file yourdomain.com.dns for Default zone scope in zone yourdomain.com.
;
$TTL 172800  ; 2 days



$ORIGIN Directive

The $ORIGIN directive was standardized in RFC 1035 and defines the domain name that will be appended to any name that appears in a Resource Record (RR) and does not end with a dot '.' (aka: relative name or unqualifed name), thus creating a Fully Qualified Domain Name (FQDN). "This is called the $ORIGIN substitution rule".
The $ORIGIN directives can appear anywhere in a Zone file and will be used form the point they are defined onwards until replaced with another $ORIGIN directive.

$ORIGIN Syntax

$ORIGIN domain-name

$ORIGIN Example

Snippets from a fictitious 'yourdomain.com' domain zone file
$ORIGIN yourdomain.com.  ; This must be a FQDN and end with a '.'



$INCLUDE Directive

The $INCLUDE directive allows inclusion of an external file that contains additional directives or Resource Records (RR). This is typically used to break up a large zone into individual files.

$INCLUDE Syntax

$INCLUDE filename [domain-name]

$INCLUDE Example

Snippets from a fictitious 'yourdomain.com' domain zone file
$INCLUDE /var/named/zones/sub.yourdomain.com  ; absolute path to sub-domain file.



See Also




This content was last updated on December 10, 2020
An error has occurred. This application may no longer respond until reloaded. Reload 🗙