Chapter 8 - $ORIGIN Directive (2024)

Chapter 8 - $ORIGIN Directive (1)

$ORIGIN defines a base name from which 'unqualified' names (those without a terminating dot) substitutions are made when processing the zone file. Zone files which do not contain an $ORIGIN directive, while being perfectly legitimate, can also be highly confusing. In general, always explicitly define an $ORIGIN directive unless there is a very good reason not to (sloth is not a very good reason).

$ORIGIN is a standard DNS directive defined in RFC 1035.

$ORIGIN values must be 'qualified' (they end with a 'dot').

Note for Purists: Technically it is legitimate to use an $ORIGIN without a terminating dot, it is then subject to the normal substitution rules. However, if used in this manner it can easily create configuation disasters than not even your mother could sort out. Practically, an $ORIGIN must terminate with a dot.

If an $ORIGIN directive is not defined - BIND synthesizes an $ORIGIN from the zone name in the named.conf file as illustrated below:

// named.conf file fragmentzone "example.com" in{type master;file "pri.example.com";};

In the above fragment $ORIGIN example.com. is synthesized if none present in the zone file (pri.example.com).

$ORIGIN is used in two contexts during zone file processing:

  1. The symbol @ forces substitution of the current (or synthesized) value of $ORIGIN. The @ symbol is replaced with the current value of $ORIGIN.
  2. The current value of $ORIGIN is added to any 'unqualified' name (any name which does not end in a 'dot').

Examples

@ Symbol replacement:

; example.com zone file fragment ; no $ORIGIN present and is synthesized from the ; zone name in named.conf....@ IN NS ns1.example.com. ; ns1.example.com is the name server for example.com....$ORIGIN uk.example.com.@ IN NS ns2.example.com. ; functionally identical to; uk.example.com IN NS ns2.example.com; ns2.example.com is the name server for uk.example.com

Unqualified name addition:

; example.com zone file fragment ; no $ORIGIN present and is synthesized from the ; zone name in named.conf....www IN A 192.168.23.15 ; functionally identical to ; www.example.com. IN A 192.162.23.15; thus ; www.example.com = IP 192.168.23.15joe IN CNAME www ;unqualified name; joe.example.com = www.example.com; could have written asjoe.example.com. IN CNAME www.example.com.....$ORIGIN uk.example.com.ftp IN A 10.0.16.34 ; functionally identical to; ftp.uk.example.com IN A 10.0.16.34

An $ORIGIN directive has scope (is effective) until either another $ORIGIN replaces it or until EOF. The following examples illustrate $ORIGIN usage.

; example.com zone file fragment...$ORIGIN example.com....smart A 192.168.2.3; smart expands to smart.example.com....$ORIGIN stupid.example.com....smarter A 192.168.2.4;smarter expands to smarter.stupid.example.com....$ORIGIN stupider.example.com....smartest A 192.168.2.5;smartest expands to smartest.stupider.example.com....$ORIGIN example.com....genius A 192.168.2.6; genius expands to genius.example.com....


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.

Chapter 8 - $ORIGIN Directive (2024)
Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 5753

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.