DekGenius.com
[ Team LiB ] Previous Section Next Section

A.1 Master File Format

(From RFC 1035, pages 33-35)

The format of these files is a sequence of entries. Entries are predominantly line-oriented, though parentheses can be used to continue a list of items across a line boundary, and text literals can contain CRLF within the text. Any combination of tabs and spaces acts as a delimiter between the separate items that make up an entry. The end of any line in the master file can end with a comment. The comment starts with a semicolon (;).

The following entries are defined:

blank[comment]

$ORIGIN domain-name [comment]

$INCLUDE file-name [domain-name] [comment]

domain-namerr [comment]

blankrr [comment]

Blank lines, with or without comments, are allowed anywhere in the file.

Two control entries are defined: $ORIGIN and $INCLUDE. $ORIGIN is followed by a domain name and resets the current origin for relative domain names to the stated name. $INCLUDE inserts the named file into the current file and may optionally specify a domain name that sets the relative domain name origin for the included file. $INCLUDE may also have a comment. Note that an $INCLUDE entry never changes the relative origin of the parent file, regardless of changes to the relative origin made within the included file.

The last two forms represent RRs. If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner. If an RR entry begins with a domain-name, then the owner name is reset.

rr contents take one of the following forms:

[
TTL] [
class] 
type RDATA
[
class] [
TTL] 
type RDATA

The RR begins with optional TTL and class fields, followed by a type and RDATA field appropriate to the type and class. Class and type use the standard mnemonics; TTL is a decimal integer. Omitted class and TTL values default to the last explicitly stated values. Since type and class mnemonics are disjoint, the parse is unique.

domain-names make up a large share of the data in the master file. The labels in the domain name are expressed as character strings and separated by dots. Quoting conventions allow arbitrary characters to be stored in domain names. Domain names that end in a dot are called absolute and are taken as complete. Domain names that do not end in a dot are called relative; the actual domain name is the concatenation of the relative part with an origin specified in an $ORIGIN, $INCLUDE, or argument to the master file-loading routine. A relative name is an error when no origin is available.

character-string is expressed in one of two ways: as a contiguous set of characters without interior spaces, or as a string beginning with " and ending with ". Inside a "-delimited string any character can occur, except for " itself, which must be quoted using a backslash (\).

Because these files are text files, several special encodings are necessary to allow arbitrary data to be loaded. In particular:


.

Of the root.


@

A free-standing @ is used to denote the current origin.


\X

X is any character other than a digit (0-9), and \ is used to quote that character so that its special meaning does not apply. For example, \. can be used to place a dot character in a label (not implemented by BIND 4.8.3).


\DDD

Each D is a digit in the octet corresponding to the decimal number described by DDD. The resulting octet is assumed to be text and is not checked for special meaning (not implemented by BIND 4.8.3).


( )

Parentheses are used to group data that crosses a line boundary. In effect, line terminations are not recognized within parentheses. (BIND 4.8.3 allows parentheses only on SOA and WKS resource records.)


;

A semicolon is used to start a comment; the remainder of the line is ignored.

A.1.1 Time to Live

(From RFC 2308, pages 7-8)

The Master File format [RFC 1035 Section 5] is extended to include the following directive:

$TTL <TTL> [comment]

All resource records appearing after the directive, and which do not explicitly include a TTL value, have their TTL set to the TTL given in the $TTL directive.

The remaining of the current meanings, of being the TTL to be used for negative responses, is the new defined meaning of the SOA minimum field.

A.1.2 Character Case

(From RFC 1035, page 9)

For all parts of the DNS that are part of the official protocol, all comparisons between character strings (e.g., labels, domain names, etc.) are done in a case-insensitive manner. At present, this rule is in force throughout the domain system without exception. However, future additions beyond current usage may need to use the full binary octet capabilities in names, so attempts to store domain names in 7-bit ASCII or use of special bytes to terminate labels, etc., should be avoided.

A.1.3 Types

Following is a list of common resource record types. The textual representation is used in master files. The binary representation is used in DNS queries and responses. These resource records are described on pages 13-21 of RFC 1035.

A (address)(From RFC 1035, page 20)

Textual representation

owner ttl class A address

Example

localhost.movie.edu.   IN A 127.0.0.1

Binary representation

Address type code: 1
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ADDRESS                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


ADDRESS

Is a 32-bit Internet address.

CNAME (canonical name)(From RFC 1035, page 14)

Textual representation

owner ttl class CNAME canonical-dname

Example

wh.movie.edu.  IN  CNAME  wormhole.movie.edu.

Binary representation

CNAME type code: 5
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                     CNAME                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


CNAME

Is a domain-name that specifies the canonical or primary name for the owner. The owner name is an alias.

MX (mail exchanger)(From RFC 1035, page 17)

Textual representation

owner ttl class 
MX preference exchange-dname

Example

ora.com.  IN  MX  0  ora.ora.com.
          IN  MX  10 ruby.ora.com.
          IN  MX  10 opal.ora.com.

Binary representation

MX type code: 15
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                  PREFERENCE                   |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   EXCHANGE                    /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


PREFERENCE

Is a 16-bit integer that specifies the preference given to this RR among others at the same owner. Lower values are preferred.


EXCHANGE

Is a domain-name that specifies a host willing to act as a mail exchange for the owner name.

NS (name server)(From RFC 1035, page 18)

Textual representation

owner ttl class NS
 name-server-dname

Example

movie.edu.  IN   NS  terminator.movie.edu

Binary representation

NS type code: 2
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   NSDNAME                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


NSDNAME

Is a domain-name that specifies a host which should be authoritative for the specified class and domain.

PTR (pointer)(From RFC 1035, page 18)

Textual representation

owner ttl class 
PTR dname

Example

1.249.249.192.in-addr.arpa.  IN PTR wormhole.movie.edu.

Binary representation

PTR type code: 12
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   PTRDNAME                    /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


PTRDNAME

Is a domain-name that points to some location in the domain name space.

SOA (start of authority)(From RFC 1035, pages 19-20)

Textual representation

owner ttl class SOA s
ource-dname mbox (serial refresh retry expire minimum)

Example

movie.edu. IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                      1        ; Serial
                      10800    ; Refresh after 3 hours
                      3600     ; Retry after 1 hour
                      604800   ; Expire after 1 week
                      86400 )  ; Minimum TTL of 1 day

Binary representation

SOA type code: 6
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                     MNAME                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                     RNAME                     /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    SERIAL                     |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    REFRESH                    |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                     RETRY                     |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    EXPIRE                     |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    MINIMUM                    |
    |                                               |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


MNAME

Is the domain-name of the name server that was the original or primary source of data for this zone.


RNAME

Is a domain-name that specifies the mailbox of the person responsible for this zone.


SERIAL

Is the unsigned 32-bit version number of the original copy of the zone. Zone transfers preserve this value. This value wraps and should be compared using sequence space arithmetic.


REFRESH

Is a 32-bit time interval before the zone should be refreshed.


RETRY

Is a 32-bit time interval that should elapse before a failed refresh should be retried.


EXPIRE

Is a 32-bit time value that specifies the upper limit on the time interval that can elapse before the zone is no longer authoritative.


MINIMUM

Is the unsigned 32-bit minimum TTL field that should be exported with any RR from this zone.

TXT (text) (From RFC 1035, page 20)

Textual representation

owner ttl class TXT txt-strings

Example

cujo.movie.edu.  IN  TXT  "Location: machine room dog house"

Binary representation

TXT type code: 16
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   TXT-DATA                    /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


TXT-DATA

Is one or more character-strings.

A.1.4 New Types from RFC 1183

RP (Responsible Person—experimental)

Textual representation

owner ttl class
 RP mbox-dname txt-dname

Example

; The current origin is fx.movie.edu
@            IN  RP   ajs.fx.movie.edu.   ajs.fx.movie.edu.
bladerunner  IN  RP   root.fx.movie.edu.  hotline.fx.movie.edu.
             IN  RP   richard.fx.movie.edu.  rb.fx.movie.edu.
ajs          IN  TXT  "Arty Segue, (415) 555-3610"
hotline      IN  TXT  "Movie U. Network Hotline, (415) 555-4111"
rb           IN  TXT  "Richard Boisclair, (415) 555-9612"

Binary representation

RP type code: 17
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                    MAILBOX                    /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                    TXTDNAME                   /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


MAILBOX

Is a domain-name that specifies the mailbox for the responsible person.


TXTDNAME

Is a domain-name for which TXT RRs exist. A subsequent query can be performed to retrieve the associated TXT resource records at txt-dname.

A.1.5 New Types from RFC 1886

AAAA (IPv6 Address)

Textual representation

owner ttl class 
AAAA ipv6-address

Example

bridgetjones.movie.edu.   IN AAAA 4321:0:1:2:3:4:567:89ab

Binary representation

Address type code: 28
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ADDRESS                     |
    |                                                |
    |                                                |
    |                                                |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


ADDRESS

Is a 128-bit Internet Protocol Version 6 address.

A.1.6 New Types from RFC 2052

SRV (service location)

Textual representation

owner ttl class 
SRV priority weight port target

Example

_http._tcp.movie.edu.  IN  SRV 1 2 80 www.fx.movie.edu.
                       IN  SRV 1 1 8080 www1.fx.movie.edu.

Binary representation

SRV type code: 33
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                   PRIORITY                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    WEIGHT                     |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                     PORT                      |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                    TARGET                     /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:


PRIORITY

Is, as for MX, the priority of this target host. A client MUST attempt to contact the target host with the lowest-numbered priority it can reach; target hosts with the same priority SHOULD be tried in pseudorandom order. The range is 0-65535.


WEIGHT

Is a load-balancing mechanism. When selecting a target host among those that have the same priority, the chance of trying this one first SHOULD be proportional to its weight. The range of this number is 1-65535. Domain administrators are urged to use Weight 0 when there isn't any load balancing to do, to make the RR easier to read for humans (less noisy).


PORT

Is the port on this target host of this service. The range is 0-65535. This is often as specified in Assigned Numbers but need not be.


TARGET

Is, as for MX, the domain name of the target host. There MUST be one or more A records for this name. Implementors are urged, but not required, to return the A record(s) in the Additional Data section. Name compression is to be used for this field. A Target of "." means that the service is decidedly not available at this domain.

A.1.7 Classes

(From RFC 1035, page 13)

CLASS fields appear in resource records. The following CLASS mnemonics and values are defined:


IN

1: the Internet


CS

2: the CSNET class (obsolete—used only for examples in some obsolete RFCs)


CH

3: the CHAOS class


HS

4: the Hesiod class

    [ Team LiB ] Previous Section Next Section