$INCLUDE allows inclusion in-situ of an external file containing additional directives. It is typically used to assist in maintenance of larger DNS files, for example, you can distribute the maintenance of individual zone files to clients without exposing the global parameters or other client zones to inspection.
$INCLUDE is a standard directive defined in RFC 1035.
The RFC is silent on the topic of embedded $INCLUDEs in $INCLUDEd files - BIND 9 documentation is similarly silent. Assume they are not permitted.
RFC 1035 defines the format as:
$INCLUDE <filename> [domain-name]
The filename may be relative (to the location of the zone files) or absolute. The optional domain-name may be used to set an explicit $ORIGIN for the included file.
An included file can also contain one or more $ORIGIN directives. The scope of the $ORIGIN directives in included files is limited to the included file. $ORIGIN will revert to its value before the $INCLUDE directive.
Examples - no $ORIGIN in included file:
$ORIGIN uk.example.com. @ IN NS ns2.example.com. ; ns2.example.com services uk.example.com $INCLUDE /var/named/uk.example.com ; absolute path ... ftp IN A 192.168.35.16 ; expands to ftp.uk.example.com
The next fragments shows the contents of the included file and how they expand.
; file statements in /var/named/uk.example.com www IN A 192.168.23.15 ; expands to www.uk.example.com ... ; end of included file
Example with ORIGIN directive:
$ORIGIN uk.example.com. @ IN NS ns2.example.com. ; ns2.example.com services uk.example.com $INCLUDE french.subdomain ; relative path file ; ORIGIN reverts to value before the $INCLUDE directive ftp IN A 192.168.35.16 ; expands to ftp.uk.example.com
Included file contents containing $ORIGIN.
$ORIGIN fr.example.com. www IN A 192.168.23.15 ; expands to www.fr.example.com ... ; end of included file
Example of explicit $ORIGIN with $INCLUDE:
$ORIGIN uk.example.com. @ IN NS ns2.example.com. ; ns2.example.com services uk.example.com $INCLUDE french.subdomain fr.example.com ; relative path ; ORIGIN reverts to value before the $INCLUDE directive ftp IN A 192.168.35.16 ; expands to ftp.uk.example.com
Included file uses $INCLUDE explicit $ORIGIN.
; no $ORIGIN directive www IN A 192.168.23.15 ; expands to www.fr.example.com ... ; end of included file
Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.
3 reverse map
4 dns types
5 install bind
8 zone records
12 bind api's
13 dns security
bits & bytes
notes & tips
This work is licensed under a Creative Commons License.
If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C STANDARDS COMPLIANT browser such as Firefox