A. DNS Message Format and Resource RecordsThis appendix outlines the format of DNS messages and enumerates all the resource record types. The resource records are shown in their textual format, as you would specify them in a DNS database file, and in their binary format, as they appear in DNS messages. You'll find a few resource records here that we didn't cover in the book because they are experimental or obsolete. We've included here the portions of RFC 1035, written by Paul Mockapetris, that deal with the textual format of master files (what we called db files or DNS database files in the book) or with the DNS message format (for those of you who need to parse DNS packets). 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 ";". The following entries are defined:
Blank lines, with or without comments, are allowed anywhere in the file.
Two control entries are defined:
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
[ 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 are default to the last explicitly stated values. Since type and class mnemonics are disjoint, the parse is unique.
Because these files are text files, several special encodings are necessary to allow arbitrary data to be loaded. In particular:
A.1.1 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.2 TypesHere is a complete list of 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.1.2.1 A address(From RFC 1035, page 20) Textual Representation:
Example: localhost.movie.edu. IN A 127.0.0.1 Binary Representation: Address type code: 1 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ADDRESS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: ADDRESS A 32 bit Internet address. A.1.2.2 CNAME canonical name(From RFC 1035, page 14) Textual Representation:
Example: wh.movie.edu. IN CNAME wormhole.movie.edu. Binary Representation: CNAME type code: 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / CNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: CNAME A A.1.2.3 HINFO host information(From RFC 1035, page 14) Textual Representation:
Example: grizzly.movie.edu. IN HINFO VAX-11/780 UNIX Binary Representation: HINFO type code: 13 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / CPU / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / OS / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: CPU A A.1.2.4 MB mailbox domain name - experimental(From RFC 1035, page 14) Textual Representation:
Example: al.movie.edu. IN MB robocop.movie.edu. Binary Representation: MB type code: 7 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / MADNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: MADNAME A A.1.2.5 MD mail destination - obsoleteMD has been replaced with MX. A.1.2.6 MF mail forwarder - obsoleteMF has been replaced with MX. A.1.2.7 MG mail group member - experimental(From RFC 1035, page 16) Textual Representation:
Example: admin.movie.edu. IN MG al.movie.edu. IN MG ed.movie.edu. IN MG jc.movie.edu. Binary Representation: MG type code: 8 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / MGMNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: MGMNAME A A.1.2.8 MINFO mailbox or mail list information - experimental(From RFC 1035, page 16) Textual Representation:
Example: admin.movie.edu. IN MINFO al.movie.edu. al.movie.edu. Binary Representation: MINFO type code: 14 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / RMAILBX / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / EMAILBX / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: RMAILBX A A.1.2.9 MR mail rename - experimental(From RFC 1035, page 17) Textual Representation:
Example: eddie.movie.edu. IN MR eddie.bornagain.edu. Binary Representation: MR type code: 9 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / NEWNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: NEWNAME A A.1.2.10 MX mail exchanger(From RFC 1035, page 17) Textual Representation:
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 A 16 bit integer which specifies the preference given to this RR among others at the same owner. Lower values are preferred. EXCHANGE A A.1.2.11 NS name server(From RFC 1035, page 18) Textual Representation:
Example: movie.edu. IN NS terminator.movie.edu Binary Representation: NS type code: 1 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / NSDNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: NSDNAME A A.1.2.12 NULL null - experimental(From RFC 1035, page 17) Binary Representation: NULL type code: 10 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / NULL is not implemented by BIND. A.1.2.13 PTR pointer(From RFC 1035, page 18) Textual Representation:
Example: 1.249.249.192.in-addr.arpa. IN PTR wormhole.movie.edu. Binary Representation: PTR type code: 12 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / PTRDNAME / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: PTRDNAME A A.1.2.14 SOA start of authority(From RFC 1035, pages 19-20) Textual Representation:
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 The A.1.2.15 TXT text(From RFC 1035, page 20) Textual Representation:
Example: cujo.movie.edu. IN TXT "Location: machine room dog house" Binary Representation: TXT type code: 16 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / TXT-DATA / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: TXT-DATA One or more A.1.2.16 WKS well-known services(From RFC 1035, page 21) Textual Representation:
Example: terminator.movie.edu. IN WKS 192.249.249.3 TCP ( telnet smtp ftp shell domain ) Binary Representation: WKS type code: 11 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ADDRESS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | PROTOCOL | | +--+--+--+--+--+--+--+--+ | | | / A.1.3 New Types from RFC 1183A.1.3.1 AFSDB Andrew File System Data Base - experimentalTextual Representation:
Example: fx.movie.edu. IN AFSDB 1 bladerunner.fx.movie.edu. IN AFSDB 2 bladerunner.fx.movie.edu. IN AFSDB 1 empire.fx.movie.edu. IN AFSDB 2 aliens.fx.movie.edu. Binary Representation: AFSDB type code: 18 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | SUBTYPE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / HOSTNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: SUBTYPE Subtype 1 is an AFS cell database server. Subtype 2 is a DCE authenticated name server. HOSTNAME A A.1.3.2 ISDN Integrated Services Digital Network address - experimentalTextual Representation:
Example: delay.hp.com. IN ISDN 141555514539488 hep.hp.com. IN ISDN 141555514539488 004 Binary Representation: ISDN type code: 20 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / ISDN ADDRESS / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / SUBADDRESS / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: ISDN ADDRESS A A.1.3.3 RP Responsible Person - experimentalTextual Representation:
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 A A.1.3.4 RT Route Through - experimentalTextual Representation:
Example: sh.prime.com. IN RT 2 Relay.Prime.COM. IN RT 10 NET.Prime.COM. Binary Representation: RT type code: 21 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | PREFERENCE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / INTERMEDIATE / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: PREFERENCE A 16 bit integer which specifies the preference given to this RR among others at the same owner. Lower values are preferred. EXCHANGE A A.1.3.5 X25 X.25 address - experimentalTextual Representation:
Example: relay.pink.com. IN X25 31105060845 Binary Representation: X25 type code: 19 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / PSDN ADDRESS / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: PSDN ADDRESS A A.1.4 New Types from RFC 1664A.1.4.1 PX pointer to X.400/RFC 822 mapping informationTextual Representation:
Example: ab.net2.it. IN PX 10 ab.net2.it. O-ab.PRMD-net2.ADMDb.C-it. Binary Representation: PX type code: 26 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | PREFERENCE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / MAP822 / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / MAPX400 / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: PREFERENCE A 16 bit integer which specifies the preference given to this RR among others at the same owner. Lower values are preferred. MAP822 A A.1.5 Classes(From RFC 1035, page 13) CLASS fields appear in resource records. The following CLASS mnemonics and values are defined: |
|