Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

rfc1035.txt 120KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077
  1. Network Working Group P. Mockapetris
  2. Request for Comments: 1035 ISI
  3. November 1987
  4. Obsoletes: RFCs 882, 883, 973
  5. DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION
  6. 1. STATUS OF THIS MEMO
  7. This RFC describes the details of the domain system and protocol, and
  8. assumes that the reader is familiar with the concepts discussed in a
  9. companion RFC, "Domain Names - Concepts and Facilities" [RFC-1034].
  10. The domain system is a mixture of functions and data types which are an
  11. official protocol and functions and data types which are still
  12. experimental. Since the domain system is intentionally extensible, new
  13. data types and experimental behavior should always be expected in parts
  14. of the system beyond the official protocol. The official protocol parts
  15. include standard queries, responses and the Internet class RR data
  16. formats (e.g., host addresses). Since the previous RFC set, several
  17. definitions have changed, so some previous definitions are obsolete.
  18. Experimental or obsolete features are clearly marked in these RFCs, and
  19. such information should be used with caution.
  20. The reader is especially cautioned not to depend on the values which
  21. appear in examples to be current or complete, since their purpose is
  22. primarily pedagogical. Distribution of this memo is unlimited.
  23. Table of Contents
  24. 1. STATUS OF THIS MEMO 1
  25. 2. INTRODUCTION 3
  26. 2.1. Overview 3
  27. 2.2. Common configurations 4
  28. 2.3. Conventions 7
  29. 2.3.1. Preferred name syntax 7
  30. 2.3.2. Data Transmission Order 8
  31. 2.3.3. Character Case 9
  32. 2.3.4. Size limits 10
  33. 3. DOMAIN NAME SPACE AND RR DEFINITIONS 10
  34. 3.1. Name space definitions 10
  35. 3.2. RR definitions 11
  36. 3.2.1. Format 11
  37. 3.2.2. TYPE values 12
  38. 3.2.3. QTYPE values 12
  39. 3.2.4. CLASS values 13
  40. Mockapetris [Page 1]
  41. RFC 1035 Domain Implementation and Specification November 1987
  42. 3.2.5. QCLASS values 13
  43. 3.3. Standard RRs 13
  44. 3.3.1. CNAME RDATA format 14
  45. 3.3.2. HINFO RDATA format 14
  46. 3.3.3. MB RDATA format (EXPERIMENTAL) 14
  47. 3.3.4. MD RDATA format (Obsolete) 15
  48. 3.3.5. MF RDATA format (Obsolete) 15
  49. 3.3.6. MG RDATA format (EXPERIMENTAL) 16
  50. 3.3.7. MINFO RDATA format (EXPERIMENTAL) 16
  51. 3.3.8. MR RDATA format (EXPERIMENTAL) 17
  52. 3.3.9. MX RDATA format 17
  53. 3.3.10. NULL RDATA format (EXPERIMENTAL) 17
  54. 3.3.11. NS RDATA format 18
  55. 3.3.12. PTR RDATA format 18
  56. 3.3.13. SOA RDATA format 19
  57. 3.3.14. TXT RDATA format 20
  58. 3.4. ARPA Internet specific RRs 20
  59. 3.4.1. A RDATA format 20
  60. 3.4.2. WKS RDATA format 21
  61. 3.5. IN-ADDR.ARPA domain 22
  62. 3.6. Defining new types, classes, and special namespaces 24
  63. 4. MESSAGES 25
  64. 4.1. Format 25
  65. 4.1.1. Header section format 26
  66. 4.1.2. Question section format 28
  67. 4.1.3. Resource record format 29
  68. 4.1.4. Message compression 30
  69. 4.2. Transport 32
  70. 4.2.1. UDP usage 32
  71. 4.2.2. TCP usage 32
  72. 5. MASTER FILES 33
  73. 5.1. Format 33
  74. 5.2. Use of master files to define zones 35
  75. 5.3. Master file example 36
  76. 6. NAME SERVER IMPLEMENTATION 37
  77. 6.1. Architecture 37
  78. 6.1.1. Control 37
  79. 6.1.2. Database 37
  80. 6.1.3. Time 39
  81. 6.2. Standard query processing 39
  82. 6.3. Zone refresh and reload processing 39
  83. 6.4. Inverse queries (Optional) 40
  84. 6.4.1. The contents of inverse queries and responses 40
  85. 6.4.2. Inverse query and response example 41
  86. 6.4.3. Inverse query processing 42
  87. Mockapetris [Page 2]
  88. RFC 1035 Domain Implementation and Specification November 1987
  89. 6.5. Completion queries and responses 42
  90. 7. RESOLVER IMPLEMENTATION 43
  91. 7.1. Transforming a user request into a query 43
  92. 7.2. Sending the queries 44
  93. 7.3. Processing responses 46
  94. 7.4. Using the cache 47
  95. 8. MAIL SUPPORT 47
  96. 8.1. Mail exchange binding 48
  97. 8.2. Mailbox binding (Experimental) 48
  98. 9. REFERENCES and BIBLIOGRAPHY 50
  99. Index 54
  100. 2. INTRODUCTION
  101. 2.1. Overview
  102. The goal of domain names is to provide a mechanism for naming resources
  103. in such a way that the names are usable in different hosts, networks,
  104. protocol families, internets, and administrative organizations.
  105. From the user's point of view, domain names are useful as arguments to a
  106. local agent, called a resolver, which retrieves information associated
  107. with the domain name. Thus a user might ask for the host address or
  108. mail information associated with a particular domain name. To enable
  109. the user to request a particular type of information, an appropriate
  110. query type is passed to the resolver with the domain name. To the user,
  111. the domain tree is a single information space; the resolver is
  112. responsible for hiding the distribution of data among name servers from
  113. the user.
  114. From the resolver's point of view, the database that makes up the domain
  115. space is distributed among various name servers. Different parts of the
  116. domain space are stored in different name servers, although a particular
  117. data item will be stored redundantly in two or more name servers. The
  118. resolver starts with knowledge of at least one name server. When the
  119. resolver processes a user query it asks a known name server for the
  120. information; in return, the resolver either receives the desired
  121. information or a referral to another name server. Using these
  122. referrals, resolvers learn the identities and contents of other name
  123. servers. Resolvers are responsible for dealing with the distribution of
  124. the domain space and dealing with the effects of name server failure by
  125. consulting redundant databases in other servers.
  126. Name servers manage two kinds of data. The first kind of data held in
  127. sets called zones; each zone is the complete database for a particular
  128. "pruned" subtree of the domain space. This data is called
  129. authoritative. A name server periodically checks to make sure that its
  130. zones are up to date, and if not, obtains a new copy of updated zones
  131. Mockapetris [Page 3]
  132. RFC 1035 Domain Implementation and Specification November 1987
  133. from master files stored locally or in another name server. The second
  134. kind of data is cached data which was acquired by a local resolver.
  135. This data may be incomplete, but improves the performance of the
  136. retrieval process when non-local data is repeatedly accessed. Cached
  137. data is eventually discarded by a timeout mechanism.
  138. This functional structure isolates the problems of user interface,
  139. failure recovery, and distribution in the resolvers and isolates the
  140. database update and refresh problems in the name servers.
  141. 2.2. Common configurations
  142. A host can participate in the domain name system in a number of ways,
  143. depending on whether the host runs programs that retrieve information
  144. from the domain system, name servers that answer queries from other
  145. hosts, or various combinations of both functions. The simplest, and
  146. perhaps most typical, configuration is shown below:
  147. Local Host | Foreign
  148. |
  149. +---------+ +----------+ | +--------+
  150. | | user queries | |queries | | |
  151. | User |-------------->| |---------|->|Foreign |
  152. | Program | | Resolver | | | Name |
  153. | |<--------------| |<--------|--| Server |
  154. | | user responses| |responses| | |
  155. +---------+ +----------+ | +--------+
  156. | A |
  157. cache additions | | references |
  158. V | |
  159. +----------+ |
  160. | cache | |
  161. +----------+ |
  162. User programs interact with the domain name space through resolvers; the
  163. format of user queries and user responses is specific to the host and
  164. its operating system. User queries will typically be operating system
  165. calls, and the resolver and its cache will be part of the host operating
  166. system. Less capable hosts may choose to implement the resolver as a
  167. subroutine to be linked in with every program that needs its services.
  168. Resolvers answer user queries with information they acquire via queries
  169. to foreign name servers and the local cache.
  170. Note that the resolver may have to make several queries to several
  171. different foreign name servers to answer a particular user query, and
  172. hence the resolution of a user query may involve several network
  173. accesses and an arbitrary amount of time. The queries to foreign name
  174. servers and the corresponding responses have a standard format described
  175. Mockapetris [Page 4]
  176. RFC 1035 Domain Implementation and Specification November 1987
  177. in this memo, and may be datagrams.
  178. Depending on its capabilities, a name server could be a stand alone
  179. program on a dedicated machine or a process or processes on a large
  180. timeshared host. A simple configuration might be:
  181. Local Host | Foreign
  182. |
  183. +---------+ |
  184. / /| |
  185. +---------+ | +----------+ | +--------+
  186. | | | | |responses| | |
  187. | | | | Name |---------|->|Foreign |
  188. | Master |-------------->| Server | | |Resolver|
  189. | files | | | |<--------|--| |
  190. | |/ | | queries | +--------+
  191. +---------+ +----------+ |
  192. Here a primary name server acquires information about one or more zones
  193. by reading master files from its local file system, and answers queries
  194. about those zones that arrive from foreign resolvers.
  195. The DNS requires that all zones be redundantly supported by more than
  196. one name server. Designated secondary servers can acquire zones and
  197. check for updates from the primary server using the zone transfer
  198. protocol of the DNS. This configuration is shown below:
  199. Local Host | Foreign
  200. |
  201. +---------+ |
  202. / /| |
  203. +---------+ | +----------+ | +--------+
  204. | | | | |responses| | |
  205. | | | | Name |---------|->|Foreign |
  206. | Master |-------------->| Server | | |Resolver|
  207. | files | | | |<--------|--| |
  208. | |/ | | queries | +--------+
  209. +---------+ +----------+ |
  210. A |maintenance | +--------+
  211. | +------------|->| |
  212. | queries | |Foreign |
  213. | | | Name |
  214. +------------------|--| Server |
  215. maintenance responses | +--------+
  216. In this configuration, the name server periodically establishes a
  217. virtual circuit to a foreign name server to acquire a copy of a zone or
  218. to check that an existing copy has not changed. The messages sent for
  219. Mockapetris [Page 5]
  220. RFC 1035 Domain Implementation and Specification November 1987
  221. these maintenance activities follow the same form as queries and
  222. responses, but the message sequences are somewhat different.
  223. The information flow in a host that supports all aspects of the domain
  224. name system is shown below:
  225. Local Host | Foreign
  226. |
  227. +---------+ +----------+ | +--------+
  228. | | user queries | |queries | | |
  229. | User |-------------->| |---------|->|Foreign |
  230. | Program | | Resolver | | | Name |
  231. | |<--------------| |<--------|--| Server |
  232. | | user responses| |responses| | |
  233. +---------+ +----------+ | +--------+
  234. | A |
  235. cache additions | | references |
  236. V | |
  237. +----------+ |
  238. | Shared | |
  239. | database | |
  240. +----------+ |
  241. A | |
  242. +---------+ refreshes | | references |
  243. / /| | V |
  244. +---------+ | +----------+ | +--------+
  245. | | | | |responses| | |
  246. | | | | Name |---------|->|Foreign |
  247. | Master |-------------->| Server | | |Resolver|
  248. | files | | | |<--------|--| |
  249. | |/ | | queries | +--------+
  250. +---------+ +----------+ |
  251. A |maintenance | +--------+
  252. | +------------|->| |
  253. | queries | |Foreign |
  254. | | | Name |
  255. +------------------|--| Server |
  256. maintenance responses | +--------+
  257. The shared database holds domain space data for the local name server
  258. and resolver. The contents of the shared database will typically be a
  259. mixture of authoritative data maintained by the periodic refresh
  260. operations of the name server and cached data from previous resolver
  261. requests. The structure of the domain data and the necessity for
  262. synchronization between name servers and resolvers imply the general
  263. characteristics of this database, but the actual format is up to the
  264. local implementor.
  265. Mockapetris [Page 6]
  266. RFC 1035 Domain Implementation and Specification November 1987
  267. Information flow can also be tailored so that a group of hosts act
  268. together to optimize activities. Sometimes this is done to offload less
  269. capable hosts so that they do not have to implement a full resolver.
  270. This can be appropriate for PCs or hosts which want to minimize the
  271. amount of new network code which is required. This scheme can also
  272. allow a group of hosts can share a small number of caches rather than
  273. maintaining a large number of separate caches, on the premise that the
  274. centralized caches will have a higher hit ratio. In either case,
  275. resolvers are replaced with stub resolvers which act as front ends to
  276. resolvers located in a recursive server in one or more name servers
  277. known to perform that service:
  278. Local Hosts | Foreign
  279. |
  280. +---------+ |
  281. | | responses |
  282. | Stub |<--------------------+ |
  283. | Resolver| | |
  284. | |----------------+ | |
  285. +---------+ recursive | | |
  286. queries | | |
  287. V | |
  288. +---------+ recursive +----------+ | +--------+
  289. | | queries | |queries | | |
  290. | Stub |-------------->| Recursive|---------|->|Foreign |
  291. | Resolver| | Server | | | Name |
  292. | |<--------------| |<--------|--| Server |
  293. +---------+ responses | |responses| | |
  294. +----------+ | +--------+
  295. | Central | |
  296. | cache | |
  297. +----------+ |
  298. In any case, note that domain components are always replicated for
  299. reliability whenever possible.
  300. 2.3. Conventions
  301. The domain system has several conventions dealing with low-level, but
  302. fundamental, issues. While the implementor is free to violate these
  303. conventions WITHIN HIS OWN SYSTEM, he must observe these conventions in
  304. ALL behavior observed from other hosts.
  305. 2.3.1. Preferred name syntax
  306. The DNS specifications attempt to be as general as possible in the rules
  307. for constructing domain names. The idea is that the name of any
  308. existing object can be expressed as a domain name with minimal changes.
  309. Mockapetris [Page 7]
  310. RFC 1035 Domain Implementation and Specification November 1987
  311. However, when assigning a domain name for an object, the prudent user
  312. will select a name which satisfies both the rules of the domain system
  313. and any existing rules for the object, whether these rules are published
  314. or implied by existing programs.
  315. For example, when naming a mail domain, the user should satisfy both the
  316. rules of this memo and those in RFC-822. When creating a new host name,
  317. the old rules for HOSTS.TXT should be followed. This avoids problems
  318. when old software is converted to use domain names.
  319. The following syntax will result in fewer problems with many
  320. applications that use domain names (e.g., mail, TELNET).
  321. <domain> ::= <subdomain> | " "
  322. <subdomain> ::= <label> | <subdomain> "." <label>
  323. <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
  324. <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
  325. <let-dig-hyp> ::= <let-dig> | "-"
  326. <let-dig> ::= <letter> | <digit>
  327. <letter> ::= any one of the 52 alphabetic characters A through Z in
  328. upper case and a through z in lower case
  329. <digit> ::= any one of the ten digits 0 through 9
  330. Note that while upper and lower case letters are allowed in domain
  331. names, no significance is attached to the case. That is, two names with
  332. the same spelling but different case are to be treated as if identical.
  333. The labels must follow the rules for ARPANET host names. They must
  334. start with a letter, end with a letter or digit, and have as interior
  335. characters only letters, digits, and hyphen. There are also some
  336. restrictions on the length. Labels must be 63 characters or less.
  337. For example, the following strings identify hosts in the Internet:
  338. A.ISI.EDU XX.LCS.MIT.EDU SRI-NIC.ARPA
  339. 2.3.2. Data Transmission Order
  340. The order of transmission of the header and data described in this
  341. document is resolved to the octet level. Whenever a diagram shows a
  342. Mockapetris [Page 8]
  343. RFC 1035 Domain Implementation and Specification November 1987
  344. group of octets, the order of transmission of those octets is the normal
  345. order in which they are read in English. For example, in the following
  346. diagram, the octets are transmitted in the order they are numbered.
  347. 0 1
  348. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  349. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  350. | 1 | 2 |
  351. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  352. | 3 | 4 |
  353. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  354. | 5 | 6 |
  355. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  356. Whenever an octet represents a numeric quantity, the left most bit in
  357. the diagram is the high order or most significant bit. That is, the bit
  358. labeled 0 is the most significant bit. For example, the following
  359. diagram represents the value 170 (decimal).
  360. 0 1 2 3 4 5 6 7
  361. +-+-+-+-+-+-+-+-+
  362. |1 0 1 0 1 0 1 0|
  363. +-+-+-+-+-+-+-+-+
  364. Similarly, whenever a multi-octet field represents a numeric quantity
  365. the left most bit of the whole field is the most significant bit. When
  366. a multi-octet quantity is transmitted the most significant octet is
  367. transmitted first.
  368. 2.3.3. Character Case
  369. For all parts of the DNS that are part of the official protocol, all
  370. comparisons between character strings (e.g., labels, domain names, etc.)
  371. are done in a case-insensitive manner. At present, this rule is in
  372. force throughout the domain system without exception. However, future
  373. additions beyond current usage may need to use the full binary octet
  374. capabilities in names, so attempts to store domain names in 7-bit ASCII
  375. or use of special bytes to terminate labels, etc., should be avoided.
  376. When data enters the domain system, its original case should be
  377. preserved whenever possible. In certain circumstances this cannot be
  378. done. For example, if two RRs are stored in a database, one at x.y and
  379. one at X.Y, they are actually stored at the same place in the database,
  380. and hence only one casing would be preserved. The basic rule is that
  381. case can be discarded only when data is used to define structure in a
  382. database, and two names are identical when compared in a case
  383. insensitive manner.
  384. Mockapetris [Page 9]
  385. RFC 1035 Domain Implementation and Specification November 1987
  386. Loss of case sensitive data must be minimized. Thus while data for x.y
  387. and X.Y may both be stored under a single location x.y or X.Y, data for
  388. a.x and B.X would never be stored under A.x, A.X, b.x, or b.X. In
  389. general, this preserves the case of the first label of a domain name,
  390. but forces standardization of interior node labels.
  391. Systems administrators who enter data into the domain database should
  392. take care to represent the data they supply to the domain system in a
  393. case-consistent manner if their system is case-sensitive. The data
  394. distribution system in the domain system will ensure that consistent
  395. representations are preserved.
  396. 2.3.4. Size limits
  397. Various objects and parameters in the DNS have size limits. They are
  398. listed below. Some could be easily changed, others are more
  399. fundamental.
  400. labels 63 octets or less
  401. names 255 octets or less
  402. TTL positive values of a signed 32 bit number.
  403. UDP messages 512 octets or less
  404. 3. DOMAIN NAME SPACE AND RR DEFINITIONS
  405. 3.1. Name space definitions
  406. Domain names in messages are expressed in terms of a sequence of labels.
  407. Each label is represented as a one octet length field followed by that
  408. number of octets. Since every domain name ends with the null label of
  409. the root, a domain name is terminated by a length byte of zero. The
  410. high order two bits of every length octet must be zero, and the
  411. remaining six bits of the length field limit the label to 63 octets or
  412. less.
  413. To simplify implementations, the total length of a domain name (i.e.,
  414. label octets and label length octets) is restricted to 255 octets or
  415. less.
  416. Although labels can contain any 8 bit values in octets that make up a
  417. label, it is strongly recommended that labels follow the preferred
  418. syntax described elsewhere in this memo, which is compatible with
  419. existing host naming conventions. Name servers and resolvers must
  420. compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII
  421. with zero parity. Non-alphabetic codes must match exactly.
  422. Mockapetris [Page 10]
  423. RFC 1035 Domain Implementation and Specification November 1987
  424. 3.2. RR definitions
  425. 3.2.1. Format
  426. All RRs have the same top level format shown below:
  427. 1 1 1 1 1 1
  428. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  429. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  430. | |
  431. / /
  432. / NAME /
  433. | |
  434. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  435. | TYPE |
  436. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  437. | CLASS |
  438. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  439. | TTL |
  440. | |
  441. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  442. | RDLENGTH |
  443. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
  444. / RDATA /
  445. / /
  446. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  447. where:
  448. NAME an owner name, i.e., the name of the node to which this
  449. resource record pertains.
  450. TYPE two octets containing one of the RR TYPE codes.
  451. CLASS two octets containing one of the RR CLASS codes.
  452. TTL a 32 bit signed integer that specifies the time interval
  453. that the resource record may be cached before the source
  454. of the information should again be consulted. Zero
  455. values are interpreted to mean that the RR can only be
  456. used for the transaction in progress, and should not be
  457. cached. For example, SOA records are always distributed
  458. with a zero TTL to prohibit caching. Zero values can
  459. also be used for extremely volatile data.
  460. RDLENGTH an unsigned 16 bit integer that specifies the length in
  461. octets of the RDATA field.
  462. Mockapetris [Page 11]
  463. RFC 1035 Domain Implementation and Specification November 1987
  464. RDATA a variable length string of octets that describes the
  465. resource. The format of this information varies
  466. according to the TYPE and CLASS of the resource record.
  467. 3.2.2. TYPE values
  468. TYPE fields are used in resource records. Note that these types are a
  469. subset of QTYPEs.
  470. TYPE value and meaning
  471. A 1 a host address
  472. NS 2 an authoritative name server
  473. MD 3 a mail destination (Obsolete - use MX)
  474. MF 4 a mail forwarder (Obsolete - use MX)
  475. CNAME 5 the canonical name for an alias
  476. SOA 6 marks the start of a zone of authority
  477. MB 7 a mailbox domain name (EXPERIMENTAL)
  478. MG 8 a mail group member (EXPERIMENTAL)
  479. MR 9 a mail rename domain name (EXPERIMENTAL)
  480. NULL 10 a null RR (EXPERIMENTAL)
  481. WKS 11 a well known service description
  482. PTR 12 a domain name pointer
  483. HINFO 13 host information
  484. MINFO 14 mailbox or mail list information
  485. MX 15 mail exchange
  486. TXT 16 text strings
  487. 3.2.3. QTYPE values
  488. QTYPE fields appear in the question part of a query. QTYPES are a
  489. superset of TYPEs, hence all TYPEs are valid QTYPEs. In addition, the
  490. following QTYPEs are defined:
  491. Mockapetris [Page 12]
  492. RFC 1035 Domain Implementation and Specification November 1987
  493. AXFR 252 A request for a transfer of an entire zone
  494. MAILB 253 A request for mailbox-related records (MB, MG or MR)
  495. MAILA 254 A request for mail agent RRs (Obsolete - see MX)
  496. * 255 A request for all records
  497. 3.2.4. CLASS values
  498. CLASS fields appear in resource records. The following CLASS mnemonics
  499. and values are defined:
  500. IN 1 the Internet
  501. CS 2 the CSNET class (Obsolete - used only for examples in
  502. some obsolete RFCs)
  503. CH 3 the CHAOS class
  504. HS 4 Hesiod [Dyer 87]
  505. 3.2.5. QCLASS values
  506. QCLASS fields appear in the question section of a query. QCLASS values
  507. are a superset of CLASS values; every CLASS is a valid QCLASS. In
  508. addition to CLASS values, the following QCLASSes are defined:
  509. * 255 any class
  510. 3.3. Standard RRs
  511. The following RR definitions are expected to occur, at least
  512. potentially, in all classes. In particular, NS, SOA, CNAME, and PTR
  513. will be used in all classes, and have the same format in all classes.
  514. Because their RDATA format is known, all domain names in the RDATA
  515. section of these RRs may be compressed.
  516. <domain-name> is a domain name represented as a series of labels, and
  517. terminated by a label with zero length. <character-string> is a single
  518. length octet followed by that number of characters. <character-string>
  519. is treated as binary information, and can be up to 256 characters in
  520. length (including the length octet).
  521. Mockapetris [Page 13]
  522. RFC 1035 Domain Implementation and Specification November 1987
  523. 3.3.1. CNAME RDATA format
  524. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  525. / CNAME /
  526. / /
  527. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  528. where:
  529. CNAME A <domain-name> which specifies the canonical or primary
  530. name for the owner. The owner name is an alias.
  531. CNAME RRs cause no additional section processing, but name servers may
  532. choose to restart the query at the canonical name in certain cases. See
  533. the description of name server logic in [RFC-1034] for details.
  534. 3.3.2. HINFO RDATA format
  535. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  536. / CPU /
  537. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  538. / OS /
  539. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  540. where:
  541. CPU A <character-string> which specifies the CPU type.
  542. OS A <character-string> which specifies the operating
  543. system type.
  544. Standard values for CPU and OS can be found in [RFC-1010].
  545. HINFO records are used to acquire general information about a host. The
  546. main use is for protocols such as FTP that can use special procedures
  547. when talking between machines or operating systems of the same type.
  548. 3.3.3. MB RDATA format (EXPERIMENTAL)
  549. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  550. / MADNAME /
  551. / /
  552. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  553. where:
  554. MADNAME A <domain-name> which specifies a host which has the
  555. specified mailbox.
  556. Mockapetris [Page 14]
  557. RFC 1035 Domain Implementation and Specification November 1987
  558. MB records cause additional section processing which looks up an A type
  559. RRs corresponding to MADNAME.
  560. 3.3.4. MD RDATA format (Obsolete)
  561. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  562. / MADNAME /
  563. / /
  564. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  565. where:
  566. MADNAME A <domain-name> which specifies a host which has a mail
  567. agent for the domain which should be able to deliver
  568. mail for the domain.
  569. MD records cause additional section processing which looks up an A type
  570. record corresponding to MADNAME.
  571. MD is obsolete. See the definition of MX and [RFC-974] for details of
  572. the new scheme. The recommended policy for dealing with MD RRs found in
  573. a master file is to reject them, or to convert them to MX RRs with a
  574. preference of 0.
  575. 3.3.5. MF RDATA format (Obsolete)
  576. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  577. / MADNAME /
  578. / /
  579. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  580. where:
  581. MADNAME A <domain-name> which specifies a host which has a mail
  582. agent for the domain which will accept mail for
  583. forwarding to the domain.
  584. MF records cause additional section processing which looks up an A type
  585. record corresponding to MADNAME.
  586. MF is obsolete. See the definition of MX and [RFC-974] for details ofw
  587. the new scheme. The recommended policy for dealing with MD RRs found in
  588. a master file is to reject them, or to convert them to MX RRs with a
  589. preference of 10.
  590. Mockapetris [Page 15]
  591. RFC 1035 Domain Implementation and Specification November 1987
  592. 3.3.6. MG RDATA format (EXPERIMENTAL)
  593. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  594. / MGMNAME /
  595. / /
  596. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  597. where:
  598. MGMNAME A <domain-name> which specifies a mailbox which is a
  599. member of the mail group specified by the domain name.
  600. MG records cause no additional section processing.
  601. 3.3.7. MINFO RDATA format (EXPERIMENTAL)
  602. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  603. / RMAILBX /
  604. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  605. / EMAILBX /
  606. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  607. where:
  608. RMAILBX A <domain-name> which specifies a mailbox which is
  609. responsible for the mailing list or mailbox. If this
  610. domain name names the root, the owner of the MINFO RR is
  611. responsible for itself. Note that many existing mailing
  612. lists use a mailbox X-request for the RMAILBX field of
  613. mailing list X, e.g., Msgroup-request for Msgroup. This
  614. field provides a more general mechanism.
  615. EMAILBX A <domain-name> which specifies a mailbox which is to
  616. receive error messages related to the mailing list or
  617. mailbox specified by the owner of the MINFO RR (similar
  618. to the ERRORS-TO: field which has been proposed). If
  619. this domain name names the root, errors should be
  620. returned to the sender of the message.
  621. MINFO records cause no additional section processing. Although these
  622. records can be associated with a simple mailbox, they are usually used
  623. with a mailing list.
  624. Mockapetris [Page 16]
  625. RFC 1035 Domain Implementation and Specification November 1987
  626. 3.3.8. MR RDATA format (EXPERIMENTAL)
  627. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  628. / NEWNAME /
  629. / /
  630. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  631. where:
  632. NEWNAME A <domain-name> which specifies a mailbox which is the
  633. proper rename of the specified mailbox.
  634. MR records cause no additional section processing. The main use for MR
  635. is as a forwarding entry for a user who has moved to a different
  636. mailbox.
  637. 3.3.9. MX RDATA format
  638. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  639. | PREFERENCE |
  640. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  641. / EXCHANGE /
  642. / /
  643. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  644. where:
  645. PREFERENCE A 16 bit integer which specifies the preference given to
  646. this RR among others at the same owner. Lower values
  647. are preferred.
  648. EXCHANGE A <domain-name> which specifies a host willing to act as
  649. a mail exchange for the owner name.
  650. MX records cause type A additional section processing for the host
  651. specified by EXCHANGE. The use of MX RRs is explained in detail in
  652. [RFC-974].
  653. 3.3.10. NULL RDATA format (EXPERIMENTAL)
  654. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  655. / <anything> /
  656. / /
  657. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  658. Anything at all may be in the RDATA field so long as it is 65535 octets
  659. or less.
  660. Mockapetris [Page 17]
  661. RFC 1035 Domain Implementation and Specification November 1987
  662. NULL records cause no additional section processing. NULL RRs are not
  663. allowed in master files. NULLs are used as placeholders in some
  664. experimental extensions of the DNS.
  665. 3.3.11. NS RDATA format
  666. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  667. / NSDNAME /
  668. / /
  669. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  670. where:
  671. NSDNAME A <domain-name> which specifies a host which should be
  672. authoritative for the specified class and domain.
  673. NS records cause both the usual additional section processing to locate
  674. a type A record, and, when used in a referral, a special search of the
  675. zone in which they reside for glue information.
  676. The NS RR states that the named host should be expected to have a zone
  677. starting at owner name of the specified class. Note that the class may
  678. not indicate the protocol family which should be used to communicate
  679. with the host, although it is typically a strong hint. For example,
  680. hosts which are name servers for either Internet (IN) or Hesiod (HS)
  681. class information are normally queried using IN class protocols.
  682. 3.3.12. PTR RDATA format
  683. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  684. / PTRDNAME /
  685. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  686. where:
  687. PTRDNAME A <domain-name> which points to some location in the
  688. domain name space.
  689. PTR records cause no additional section processing. These RRs are used
  690. in special domains to point to some other location in the domain space.
  691. These records are simple data, and don't imply any special processing
  692. similar to that performed by CNAME, which identifies aliases. See the
  693. description of the IN-ADDR.ARPA domain for an example.
  694. Mockapetris [Page 18]
  695. RFC 1035 Domain Implementation and Specification November 1987
  696. 3.3.13. SOA RDATA format
  697. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  698. / MNAME /
  699. / /
  700. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  701. / RNAME /
  702. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  703. | SERIAL |
  704. | |
  705. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  706. | REFRESH |
  707. | |
  708. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  709. | RETRY |
  710. | |
  711. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  712. | EXPIRE |
  713. | |
  714. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  715. | MINIMUM |
  716. | |
  717. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  718. where:
  719. MNAME The <domain-name> of the name server that was the
  720. original or primary source of data for this zone.
  721. RNAME A <domain-name> which specifies the mailbox of the
  722. person responsible for this zone.
  723. SERIAL The unsigned 32 bit version number of the original copy
  724. of the zone. Zone transfers preserve this value. This
  725. value wraps and should be compared using sequence space
  726. arithmetic.
  727. REFRESH A 32 bit time interval before the zone should be
  728. refreshed.
  729. RETRY A 32 bit time interval that should elapse before a
  730. failed refresh should be retried.
  731. EXPIRE A 32 bit time value that specifies the upper limit on
  732. the time interval that can elapse before the zone is no
  733. longer authoritative.
  734. Mockapetris [Page 19]
  735. RFC 1035 Domain Implementation and Specification November 1987
  736. MINIMUM The unsigned 32 bit minimum TTL field that should be
  737. exported with any RR from this zone.
  738. SOA records cause no additional section processing.
  739. All times are in units of seconds.
  740. Most of these fields are pertinent only for name server maintenance
  741. operations. However, MINIMUM is used in all query operations that
  742. retrieve RRs from a zone. Whenever a RR is sent in a response to a
  743. query, the TTL field is set to the maximum of the TTL field from the RR
  744. and the MINIMUM field in the appropriate SOA. Thus MINIMUM is a lower
  745. bound on the TTL field for all RRs in a zone. Note that this use of
  746. MINIMUM should occur when the RRs are copied into the response and not
  747. when the zone is loaded from a master file or via a zone transfer. The
  748. reason for this provison is to allow future dynamic update facilities to
  749. change the SOA RR with known semantics.
  750. 3.3.14. TXT RDATA format
  751. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  752. / TXT-DATA /
  753. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  754. where:
  755. TXT-DATA One or more <character-string>s.
  756. TXT RRs are used to hold descriptive text. The semantics of the text
  757. depends on the domain where it is found.
  758. 3.4. Internet specific RRs
  759. 3.4.1. A RDATA format
  760. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  761. | ADDRESS |
  762. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  763. where:
  764. ADDRESS A 32 bit Internet address.
  765. Hosts that have multiple Internet addresses will have multiple A
  766. records.
  767. Mockapetris [Page 20]
  768. RFC 1035 Domain Implementation and Specification November 1987
  769. A records cause no additional section processing. The RDATA section of
  770. an A line in a master file is an Internet address expressed as four
  771. decimal numbers separated by dots without any imbedded spaces (e.g.,
  772. "10.2.0.52" or "192.0.5.6").
  773. 3.4.2. WKS RDATA format
  774. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  775. | ADDRESS |
  776. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  777. | PROTOCOL | |
  778. +--+--+--+--+--+--+--+--+ |
  779. | |
  780. / <BIT MAP> /
  781. / /
  782. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  783. where:
  784. ADDRESS An 32 bit Internet address
  785. PROTOCOL An 8 bit IP protocol number
  786. <BIT MAP> A variable length bit map. The bit map must be a
  787. multiple of 8 bits long.
  788. The WKS record is used to describe the well known services supported by
  789. a particular protocol on a particular internet address. The PROTOCOL
  790. field specifies an IP protocol number, and the bit map has one bit per
  791. port of the specified protocol. The first bit corresponds to port 0,
  792. the second to port 1, etc. If the bit map does not include a bit for a
  793. protocol of interest, that bit is assumed zero. The appropriate values
  794. and mnemonics for ports and protocols are specified in [RFC-1010].
  795. For example, if PROTOCOL=TCP (6), the 26th bit corresponds to TCP port
  796. 25 (SMTP). If this bit is set, a SMTP server should be listening on TCP
  797. port 25; if zero, SMTP service is not supported on the specified
  798. address.
  799. The purpose of WKS RRs is to provide availability information for
  800. servers for TCP and UDP. If a server supports both TCP and UDP, or has
  801. multiple Internet addresses, then multiple WKS RRs are used.
  802. WKS RRs cause no additional section processing.
  803. In master files, both ports and protocols are expressed using mnemonics
  804. or decimal numbers.
  805. Mockapetris [Page 21]
  806. RFC 1035 Domain Implementation and Specification November 1987
  807. 3.5. IN-ADDR.ARPA domain
  808. The Internet uses a special domain to support gateway location and
  809. Internet address to host mapping. Other classes may employ a similar
  810. strategy in other domains. The intent of this domain is to provide a
  811. guaranteed method to perform host address to host name mapping, and to
  812. facilitate queries to locate all gateways on a particular network in the
  813. Internet.
  814. Note that both of these services are similar to functions that could be
  815. performed by inverse queries; the difference is that this part of the
  816. domain name space is structured according to address, and hence can
  817. guarantee that the appropriate data can be located without an exhaustive
  818. search of the domain space.
  819. The domain begins at IN-ADDR.ARPA and has a substructure which follows
  820. the Internet addressing structure.
  821. Domain names in the IN-ADDR.ARPA domain are defined to have up to four
  822. labels in addition to the IN-ADDR.ARPA suffix. Each label represents
  823. one octet of an Internet address, and is expressed as a character string
  824. for a decimal value in the range 0-255 (with leading zeros omitted
  825. except in the case of a zero octet which is represented by a single
  826. zero).
  827. Host addresses are represented by domain names that have all four labels
  828. specified. Thus data for Internet address 10.2.0.52 is located at
  829. domain name 52.0.2.10.IN-ADDR.ARPA. The reversal, though awkward to
  830. read, allows zones to be delegated which are exactly one network of
  831. address space. For example, 10.IN-ADDR.ARPA can be a zone containing
  832. data for the ARPANET, while 26.IN-ADDR.ARPA can be a separate zone for
  833. MILNET. Address nodes are used to hold pointers to primary host names
  834. in the normal domain space.
  835. Network numbers correspond to some non-terminal nodes at various depths
  836. in the IN-ADDR.ARPA domain, since Internet network numbers are either 1,
  837. 2, or 3 octets. Network nodes are used to hold pointers to the primary
  838. host names of gateways attached to that network. Since a gateway is, by
  839. definition, on more than one network, it will typically have two or more
  840. network nodes which point at it. Gateways will also have host level
  841. pointers at their fully qualified addresses.
  842. Both the gateway pointers at network nodes and the normal host pointers
  843. at full address nodes use the PTR RR to point back to the primary domain
  844. names of the corresponding hosts.
  845. For example, the IN-ADDR.ARPA domain will contain information about the
  846. ISI gateway between net 10 and 26, an MIT gateway from net 10 to MIT's
  847. Mockapetris [Page 22]
  848. RFC 1035 Domain Implementation and Specification November 1987
  849. net 18, and hosts A.ISI.EDU and MULTICS.MIT.EDU. Assuming that ISI
  850. gateway has addresses 10.2.0.22 and 26.0.0.103, and a name MILNET-
  851. GW.ISI.EDU, and the MIT gateway has addresses 10.0.0.77 and 18.10.0.4
  852. and a name GW.LCS.MIT.EDU, the domain database would contain:
  853. 10.IN-ADDR.ARPA. PTR MILNET-GW.ISI.EDU.
  854. 10.IN-ADDR.ARPA. PTR GW.LCS.MIT.EDU.
  855. 18.IN-ADDR.ARPA. PTR GW.LCS.MIT.EDU.
  856. 26.IN-ADDR.ARPA. PTR MILNET-GW.ISI.EDU.
  857. 22.0.2.10.IN-ADDR.ARPA. PTR MILNET-GW.ISI.EDU.
  858. 103.0.0.26.IN-ADDR.ARPA. PTR MILNET-GW.ISI.EDU.
  859. 77.0.0.10.IN-ADDR.ARPA. PTR GW.LCS.MIT.EDU.
  860. 4.0.10.18.IN-ADDR.ARPA. PTR GW.LCS.MIT.EDU.
  861. 103.0.3.26.IN-ADDR.ARPA. PTR A.ISI.EDU.
  862. 6.0.0.10.IN-ADDR.ARPA. PTR MULTICS.MIT.EDU.
  863. Thus a program which wanted to locate gateways on net 10 would originate
  864. a query of the form QTYPE=PTR, QCLASS=IN, QNAME=10.IN-ADDR.ARPA. It
  865. would receive two RRs in response:
  866. 10.IN-ADDR.ARPA. PTR MILNET-GW.ISI.EDU.
  867. 10.IN-ADDR.ARPA. PTR GW.LCS.MIT.EDU.
  868. The program could then originate QTYPE=A, QCLASS=IN queries for MILNET-
  869. GW.ISI.EDU. and GW.LCS.MIT.EDU. to discover the Internet addresses of
  870. these gateways.
  871. A resolver which wanted to find the host name corresponding to Internet
  872. host address 10.0.0.6 would pursue a query of the form QTYPE=PTR,
  873. QCLASS=IN, QNAME=6.0.0.10.IN-ADDR.ARPA, and would receive:
  874. 6.0.0.10.IN-ADDR.ARPA. PTR MULTICS.MIT.EDU.
  875. Several cautions apply to the use of these services:
  876. - Since the IN-ADDR.ARPA special domain and the normal domain
  877. for a particular host or gateway will be in different zones,
  878. the possibility exists that that the data may be inconsistent.
  879. - Gateways will often have two names in separate domains, only
  880. one of which can be primary.
  881. - Systems that use the domain database to initialize their
  882. routing tables must start with enough gateway information to
  883. guarantee that they can access the appropriate name server.
  884. - The gateway data only reflects the existence of a gateway in a
  885. manner equivalent to the current HOSTS.TXT file. It doesn't
  886. replace the dynamic availability information from GGP or EGP.
  887. Mockapetris [Page 23]
  888. RFC 1035 Domain Implementation and Specification November 1987
  889. 3.6. Defining new types, classes, and special namespaces
  890. The previously defined types and classes are the ones in use as of the
  891. date of this memo. New definitions should be expected. This section
  892. makes some recommendations to designers considering additions to the
  893. existing facilities. The mailing list NAMEDROPPERS@SRI-NIC.ARPA is the
  894. forum where general discussion of design issues takes place.
  895. In general, a new type is appropriate when new information is to be
  896. added to the database about an existing object, or we need new data
  897. formats for some totally new object. Designers should attempt to define
  898. types and their RDATA formats that are generally applicable to all
  899. classes, and which avoid duplication of information. New classes are
  900. appropriate when the DNS is to be used for a new protocol, etc which
  901. requires new class-specific data formats, or when a copy of the existing
  902. name space is desired, but a separate management domain is necessary.
  903. New types and classes need mnemonics for master files; the format of the
  904. master files requires that the mnemonics for type and class be disjoint.
  905. TYPE and CLASS values must be a proper subset of QTYPEs and QCLASSes
  906. respectively.
  907. The present system uses multiple RRs to represent multiple values of a
  908. type rather than storing multiple values in the RDATA section of a
  909. single RR. This is less efficient for most applications, but does keep
  910. RRs shorter. The multiple RRs assumption is incorporated in some
  911. experimental work on dynamic update methods.
  912. The present system attempts to minimize the duplication of data in the
  913. database in order to insure consistency. Thus, in order to find the
  914. address of the host for a mail exchange, you map the mail domain name to
  915. a host name, then the host name to addresses, rather than a direct
  916. mapping to host address. This approach is preferred because it avoids
  917. the opportunity for inconsistency.
  918. In defining a new type of data, multiple RR types should not be used to
  919. create an ordering between entries or express different formats for
  920. equivalent bindings, instead this information should be carried in the
  921. body of the RR and a single type used. This policy avoids problems with
  922. caching multiple types and defining QTYPEs to match multiple types.
  923. For example, the original form of mail exchange binding used two RR
  924. types one to represent a "closer" exchange (MD) and one to represent a
  925. "less close" exchange (MF). The difficulty is that the presence of one
  926. RR type in a cache doesn't convey any information about the other
  927. because the query which acquired the cached information might have used
  928. a QTYPE of MF, MD, or MAILA (which matched both). The redesigned
  929. Mockapetris [Page 24]
  930. RFC 1035 Domain Implementation and Specification November 1987
  931. service used a single type (MX) with a "preference" value in the RDATA
  932. section which can order different RRs. However, if any MX RRs are found
  933. in the cache, then all should be there.
  934. 4. MESSAGES
  935. 4.1. Format
  936. All communications inside of the domain protocol are carried in a single
  937. format called a message. The top level format of message is divided
  938. into 5 sections (some of which are empty in certain cases) shown below:
  939. +---------------------+
  940. | Header |
  941. +---------------------+
  942. | Question | the question for the name server
  943. +---------------------+
  944. | Answer | RRs answering the question
  945. +---------------------+
  946. | Authority | RRs pointing toward an authority
  947. +---------------------+
  948. | Additional | RRs holding additional information
  949. +---------------------+
  950. The header section is always present. The header includes fields that
  951. specify which of the remaining sections are present, and also specify
  952. whether the message is a query or a response, a standard query or some
  953. other opcode, etc.
  954. The names of the sections after the header are derived from their use in
  955. standard queries. The question section contains fields that describe a
  956. question to a name server. These fields are a query type (QTYPE), a
  957. query class (QCLASS), and a query domain name (QNAME). The last three
  958. sections have the same format: a possibly empty list of concatenated
  959. resource records (RRs). The answer section contains RRs that answer the
  960. question; the authority section contains RRs that point toward an
  961. authoritative name server; the additional records section contains RRs
  962. which relate to the query, but are not strictly answers for the
  963. question.
  964. Mockapetris [Page 25]
  965. RFC 1035 Domain Implementation and Specification November 1987
  966. 4.1.1. Header section format
  967. The header contains the following fields:
  968. 1 1 1 1 1 1
  969. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  970. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  971. | ID |
  972. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  973. |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
  974. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  975. | QDCOUNT |
  976. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  977. | ANCOUNT |
  978. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  979. | NSCOUNT |
  980. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  981. | ARCOUNT |
  982. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  983. where:
  984. ID A 16 bit identifier assigned by the program that
  985. generates any kind of query. This identifier is copied
  986. the corresponding reply and can be used by the requester
  987. to match up replies to outstanding queries.
  988. QR A one bit field that specifies whether this message is a
  989. query (0), or a response (1).
  990. OPCODE A four bit field that specifies kind of query in this
  991. message. This value is set by the originator of a query
  992. and copied into the response. The values are:
  993. 0 a standard query (QUERY)
  994. 1 an inverse query (IQUERY)
  995. 2 a server status request (STATUS)
  996. 3-15 reserved for future use
  997. AA Authoritative Answer - this bit is valid in responses,
  998. and specifies that the responding name server is an
  999. authority for the domain name in question section.
  1000. Note that the contents of the answer section may have
  1001. multiple owner names because of aliases. The AA bit
  1002. Mockapetris [Page 26]
  1003. RFC 1035 Domain Implementation and Specification November 1987
  1004. corresponds to the name which matches the query name, or
  1005. the first owner name in the answer section.
  1006. TC TrunCation - specifies that this message was truncated
  1007. due to length greater than that permitted on the
  1008. transmission channel.
  1009. RD Recursion Desired - this bit may be set in a query and
  1010. is copied into the response. If RD is set, it directs
  1011. the name server to pursue the query recursively.
  1012. Recursive query support is optional.
  1013. RA Recursion Available - this be is set or cleared in a
  1014. response, and denotes whether recursive query support is
  1015. available in the name server.
  1016. Z Reserved for future use. Must be zero in all queries
  1017. and responses.
  1018. RCODE Response code - this 4 bit field is set as part of
  1019. responses. The values have the following
  1020. interpretation:
  1021. 0 No error condition
  1022. 1 Format error - The name server was
  1023. unable to interpret the query.
  1024. 2 Server failure - The name server was
  1025. unable to process this query due to a
  1026. problem with the name server.
  1027. 3 Name Error - Meaningful only for
  1028. responses from an authoritative name
  1029. server, this code signifies that the
  1030. domain name referenced in the query does
  1031. not exist.
  1032. 4 Not Implemented - The name server does
  1033. not support the requested kind of query.
  1034. 5 Refused - The name server refuses to
  1035. perform the specified operation for
  1036. policy reasons. For example, a name
  1037. server may not wish to provide the
  1038. information to the particular requester,
  1039. or a name server may not wish to perform
  1040. a particular operation (e.g., zone
  1041. Mockapetris [Page 27]
  1042. RFC 1035 Domain Implementation and Specification November 1987
  1043. transfer) for particular data.
  1044. 6-15 Reserved for future use.
  1045. QDCOUNT an unsigned 16 bit integer specifying the number of
  1046. entries in the question section.
  1047. ANCOUNT an unsigned 16 bit integer specifying the number of
  1048. resource records in the answer section.
  1049. NSCOUNT an unsigned 16 bit integer specifying the number of name
  1050. server resource records in the authority records
  1051. section.
  1052. ARCOUNT an unsigned 16 bit integer specifying the number of
  1053. resource records in the additional records section.
  1054. 4.1.2. Question section format
  1055. The question section is used to carry the "question" in most queries,
  1056. i.e., the parameters that define what is being asked. The section
  1057. contains QDCOUNT (usually 1) entries, each of the following format:
  1058. 1 1 1 1 1 1
  1059. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  1060. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1061. | |
  1062. / QNAME /
  1063. / /
  1064. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1065. | QTYPE |
  1066. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1067. | QCLASS |
  1068. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1069. where:
  1070. QNAME a domain name represented as a sequence of labels, where
  1071. each label consists of a length octet followed by that
  1072. number of octets. The domain name terminates with the
  1073. zero length octet for the null label of the root. Note
  1074. that this field may be an odd number of octets; no
  1075. padding is used.
  1076. QTYPE a two octet code which specifies the type of the query.
  1077. The values for this field include all codes valid for a
  1078. TYPE field, together with some more general codes which
  1079. can match more than one type of RR.
  1080. Mockapetris [Page 28]
  1081. RFC 1035 Domain Implementation and Specification November 1987
  1082. QCLASS a two octet code that specifies the class of the query.
  1083. For example, the QCLASS field is IN for the Internet.
  1084. 4.1.3. Resource record format
  1085. The answer, authority, and additional sections all share the same
  1086. format: a variable number of resource records, where the number of
  1087. records is specified in the corresponding count field in the header.
  1088. Each resource record has the following format:
  1089. 1 1 1 1 1 1
  1090. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  1091. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1092. | |
  1093. / /
  1094. / NAME /
  1095. | |
  1096. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1097. | TYPE |
  1098. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1099. | CLASS |
  1100. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1101. | TTL |
  1102. | |
  1103. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1104. | RDLENGTH |
  1105. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
  1106. / RDATA /
  1107. / /
  1108. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1109. where:
  1110. NAME a domain name to which this resource record pertains.
  1111. TYPE two octets containing one of the RR type codes. This
  1112. field specifies the meaning of the data in the RDATA
  1113. field.
  1114. CLASS two octets which specify the class of the data in the
  1115. RDATA field.
  1116. TTL a 32 bit unsigned integer that specifies the time
  1117. interval (in seconds) that the resource record may be
  1118. cached before it should be discarded. Zero values are
  1119. interpreted to mean that the RR can only be used for the
  1120. transaction in progress, and should not be cached.
  1121. Mockapetris [Page 29]
  1122. RFC 1035 Domain Implementation and Specification November 1987
  1123. RDLENGTH an unsigned 16 bit integer that specifies the length in
  1124. octets of the RDATA field.
  1125. RDATA a variable length string of octets that describes the
  1126. resource. The format of this information varies
  1127. according to the TYPE and CLASS of the resource record.
  1128. For example, the if the TYPE is A and the CLASS is IN,
  1129. the RDATA field is a 4 octet ARPA Internet address.
  1130. 4.1.4. Message compression
  1131. In order to reduce the size of messages, the domain system utilizes a
  1132. compression scheme which eliminates the repetition of domain names in a
  1133. message. In this scheme, an entire domain name or a list of labels at
  1134. the end of a domain name is replaced with a pointer to a prior occurance
  1135. of the same name.
  1136. The pointer takes the form of a two octet sequence:
  1137. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1138. | 1 1| OFFSET |
  1139. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1140. The first two bits are ones. This allows a pointer to be distinguished
  1141. from a label, since the label must begin with two zero bits because
  1142. labels are restricted to 63 octets or less. (The 10 and 01 combinations
  1143. are reserved for future use.) The OFFSET field specifies an offset from
  1144. the start of the message (i.e., the first octet of the ID field in the
  1145. domain header). A zero offset specifies the first byte of the ID field,
  1146. etc.
  1147. The compression scheme allows a domain name in a message to be
  1148. represented as either:
  1149. - a sequence of labels ending in a zero octet
  1150. - a pointer
  1151. - a sequence of labels ending with a pointer
  1152. Pointers can only be used for occurances of a domain name where the
  1153. format is not class specific. If this were not the case, a name server
  1154. or resolver would be required to know the format of all RRs it handled.
  1155. As yet, there are no such cases, but they may occur in future RDATA
  1156. formats.
  1157. If a domain name is contained in a part of the message subject to a
  1158. length field (such as the RDATA section of an RR), and compression is
  1159. Mockapetris [Page 30]
  1160. RFC 1035 Domain Implementation and Specification November 1987
  1161. used, the length of the compressed name is used in the length
  1162. calculation, rather than the length of the expanded name.
  1163. Programs are free to avoid using pointers in messages they generate,
  1164. although this will reduce datagram capacity, and may cause truncation.
  1165. However all programs are required to understand arriving messages that
  1166. contain pointers.
  1167. For example, a datagram might need to use the domain names F.ISI.ARPA,
  1168. FOO.F.ISI.ARPA, ARPA, and the root. Ignoring the other fields of the
  1169. message, these domain names might be represented as:
  1170. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1171. 20 | 1 | F |
  1172. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1173. 22 | 3 | I |
  1174. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1175. 24 | S | I |
  1176. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1177. 26 | 4 | A |
  1178. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1179. 28 | R | P |
  1180. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1181. 30 | A | 0 |
  1182. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1183. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1184. 40 | 3 | F |
  1185. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1186. 42 | O | O |
  1187. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1188. 44 | 1 1| 20 |
  1189. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1190. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1191. 64 | 1 1| 26 |
  1192. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1193. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1194. 92 | 0 | |
  1195. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1196. The domain name for F.ISI.ARPA is shown at offset 20. The domain name
  1197. FOO.F.ISI.ARPA is shown at offset 40; this definition uses a pointer to
  1198. concatenate a label for FOO to the previously defined F.ISI.ARPA. The
  1199. domain name ARPA is defined at offset 64 using a pointer to the ARPA
  1200. component of the name F.ISI.ARPA at 20; note that this pointer relies on
  1201. ARPA being the last label in the string at 20. The root domain name is
  1202. Mockapetris [Page 31]
  1203. RFC 1035 Domain Implementation and Specification November 1987
  1204. defined by a single octet of zeros at 92; the root domain name has no
  1205. labels.
  1206. 4.2. Transport
  1207. The DNS assumes that messages will be transmitted as datagrams or in a
  1208. byte stream carried by a virtual circuit. While virtual circuits can be
  1209. used for any DNS activity, datagrams are preferred for queries due to
  1210. their lower overhead and better performance. Zone refresh activities
  1211. must use virtual circuits because of the need for reliable transfer.
  1212. The Internet supports name server access using TCP [RFC-793] on server
  1213. port 53 (decimal) as well as datagram access using UDP [RFC-768] on UDP
  1214. port 53 (decimal).
  1215. 4.2.1. UDP usage
  1216. Messages sent using UDP user server port 53 (decimal).
  1217. Messages carried by UDP are restricted to 512 bytes (not counting the IP
  1218. or UDP headers). Longer messages are truncated and the TC bit is set in
  1219. the header.
  1220. UDP is not acceptable for zone transfers, but is the recommended method
  1221. for standard queries in the Internet. Queries sent using UDP may be
  1222. lost, and hence a retransmission strategy is required. Queries or their
  1223. responses may be reordered by the network, or by processing in name
  1224. servers, so resolvers should not depend on them being returned in order.
  1225. The optimal UDP retransmission policy will vary with performance of the
  1226. Internet and the needs of the client, but the following are recommended:
  1227. - The client should try other servers and server addresses
  1228. before repeating a query to a specific address of a server.
  1229. - The retransmission interval should be based on prior
  1230. statistics if possible. Too aggressive retransmission can
  1231. easily slow responses for the community at large. Depending
  1232. on how well connected the client is to its expected servers,
  1233. the minimum retransmission interval should be 2-5 seconds.
  1234. More suggestions on server selection and retransmission policy can be
  1235. found in the resolver section of this memo.
  1236. 4.2.2. TCP usage
  1237. Messages sent over TCP connections use server port 53 (decimal). The
  1238. message is prefixed with a two byte length field which gives the message
  1239. Mockapetris [Page 32]
  1240. RFC 1035 Domain Implementation and Specification November 1987
  1241. length, excluding the two byte length field. This length field allows
  1242. the low-level processing to assemble a complete message before beginning
  1243. to parse it.
  1244. Several connection management policies are recommended:
  1245. - The server should not block other activities waiting for TCP
  1246. data.
  1247. - The server should support multiple connections.
  1248. - The server should assume that the client will initiate
  1249. connection closing, and should delay closing its end of the
  1250. connection until all outstanding client requests have been
  1251. satisfied.
  1252. - If the server needs to close a dormant connection to reclaim
  1253. resources, it should wait until the connection has been idle
  1254. for a period on the order of two minutes. In particular, the
  1255. server should allow the SOA and AXFR request sequence (which
  1256. begins a refresh operation) to be made on a single connection.
  1257. Since the server would be unable to answer queries anyway, a
  1258. unilateral close or reset may be used instead of a graceful
  1259. close.
  1260. 5. MASTER FILES
  1261. Master files are text files that contain RRs in text form. Since the
  1262. contents of a zone can be expressed in the form of a list of RRs a
  1263. master file is most often used to define a zone, though it can be used
  1264. to list a cache's contents. Hence, this section first discusses the
  1265. format of RRs in a master file, and then the special considerations when
  1266. a master file is used to create a zone in some name server.
  1267. 5.1. Format
  1268. The format of these files is a sequence of entries. Entries are
  1269. predominantly line-oriented, though parentheses can be used to continue
  1270. a list of items across a line boundary, and text literals can contain
  1271. CRLF within the text. Any combination of tabs and spaces act as a
  1272. delimiter between the separate items that make up an entry. The end of
  1273. any line in the master file can end with a comment. The comment starts
  1274. with a ";" (semicolon).
  1275. The following entries are defined:
  1276. <blank>[<comment>]
  1277. Mockapetris [Page 33]
  1278. RFC 1035 Domain Implementation and Specification November 1987
  1279. $ORIGIN <domain-name> [<comment>]
  1280. $INCLUDE <file-name> [<domain-name>] [<comment>]
  1281. <domain-name><rr> [<comment>]
  1282. <blank><rr> [<comment>]
  1283. Blank lines, with or without comments, are allowed anywhere in the file.
  1284. Two control entries are defined: $ORIGIN and $INCLUDE. $ORIGIN is
  1285. followed by a domain name, and resets the current origin for relative
  1286. domain names to the stated name. $INCLUDE inserts the named file into
  1287. the current file, and may optionally specify a domain name that sets the
  1288. relative domain name origin for the included file. $INCLUDE may also
  1289. have a comment. Note that a $INCLUDE entry never changes the relative
  1290. origin of the parent file, regardless of changes to the relative origin
  1291. made within the included file.
  1292. The last two forms represent RRs. If an entry for an RR begins with a
  1293. blank, then the RR is assumed to be owned by the last stated owner. If
  1294. an RR entry begins with a <domain-name>, then the owner name is reset.
  1295. <rr> contents take one of the following forms:
  1296. [<TTL>] [<class>] <type> <RDATA>
  1297. [<class>] [<TTL>] <type> <RDATA>
  1298. The RR begins with optional TTL and class fields, followed by a type and
  1299. RDATA field appropriate to the type and class. Class and type use the
  1300. standard mnemonics, TTL is a decimal integer. Omitted class and TTL
  1301. values are default to the last explicitly stated values. Since type and
  1302. class mnemonics are disjoint, the parse is unique. (Note that this
  1303. order is different from the order used in examples and the order used in
  1304. the actual RRs; the given order allows easier parsing and defaulting.)
  1305. <domain-name>s make up a large share of the data in the master file.
  1306. The labels in the domain name are expressed as character strings and
  1307. separated by dots. Quoting conventions allow arbitrary characters to be
  1308. stored in domain names. Domain names that end in a dot are called
  1309. absolute, and are taken as complete. Domain names which do not end in a
  1310. dot are called relative; the actual domain name is the concatenation of
  1311. the relative part with an origin specified in a $ORIGIN, $INCLUDE, or as
  1312. an argument to the master file loading routine. A relative name is an
  1313. error when no origin is available.
  1314. Mockapetris [Page 34]
  1315. RFC 1035 Domain Implementation and Specification November 1987
  1316. <character-string> is expressed in one or two ways: as a contiguous set
  1317. of characters without interior spaces, or as a string beginning with a "
  1318. and ending with a ". Inside a " delimited string any character can
  1319. occur, except for a " itself, which must be quoted using \ (back slash).
  1320. Because these files are text files several special encodings are
  1321. necessary to allow arbitrary data to be loaded. In particular:
  1322. of the root.
  1323. @ A free standing @ is used to denote the current origin.
  1324. \X where X is any character other than a digit (0-9), is
  1325. used to quote that character so that its special meaning
  1326. does not apply. For example, "\." can be used to place
  1327. a dot character in a label.
  1328. \DDD where each D is a digit is the octet corresponding to
  1329. the decimal number described by DDD. The resulting
  1330. octet is assumed to be text and is not checked for
  1331. special meaning.
  1332. ( ) Parentheses are used to group data that crosses a line
  1333. boundary. In effect, line terminations are not
  1334. recognized within parentheses.
  1335. ; Semicolon is used to start a comment; the remainder of
  1336. the line is ignored.
  1337. 5.2. Use of master files to define zones
  1338. When a master file is used to load a zone, the operation should be
  1339. suppressed if any errors are encountered in the master file. The
  1340. rationale for this is that a single error can have widespread
  1341. consequences. For example, suppose that the RRs defining a delegation
  1342. have syntax errors; then the server will return authoritative name
  1343. errors for all names in the subzone (except in the case where the
  1344. subzone is also present on the server).
  1345. Several other validity checks that should be performed in addition to
  1346. insuring that the file is syntactically correct:
  1347. 1. All RRs in the file should have the same class.
  1348. 2. Exactly one SOA RR should be present at the top of the zone.
  1349. 3. If delegations are present and glue information is required,
  1350. it should be present.
  1351. Mockapetris [Page 35]
  1352. RFC 1035 Domain Implementation and Specification November 1987
  1353. 4. Information present outside of the authoritative nodes in the
  1354. zone should be glue information, rather than the result of an
  1355. origin or similar error.
  1356. 5.3. Master file example
  1357. The following is an example file which might be used to define the
  1358. ISI.EDU zone.and is loaded with an origin of ISI.EDU:
  1359. @ IN SOA VENERA Action\.domains (
  1360. 20 ; SERIAL
  1361. 7200 ; REFRESH
  1362. 600 ; RETRY
  1363. 3600000; EXPIRE
  1364. 60) ; MINIMUM
  1365. NS A.ISI.EDU.
  1366. NS VENERA
  1367. NS VAXA
  1368. MX 10 VENERA
  1369. MX 20 VAXA
  1370. A A 26.3.0.103
  1371. VENERA A 10.1.0.52
  1372. A 128.9.0.32
  1373. VAXA A 10.2.0.27
  1374. A 128.9.0.33
  1375. $INCLUDE <SUBSYS>ISI-MAILBOXES.TXT
  1376. Where the file <SUBSYS>ISI-MAILBOXES.TXT is:
  1377. MOE MB A.ISI.EDU.
  1378. LARRY MB A.ISI.EDU.
  1379. CURLEY MB A.ISI.EDU.
  1380. STOOGES MG MOE
  1381. MG LARRY
  1382. MG CURLEY
  1383. Note the use of the \ character in the SOA RR to specify the responsible
  1384. person mailbox "Action.domains@E.ISI.EDU".
  1385. Mockapetris [Page 36]
  1386. RFC 1035 Domain Implementation and Specification November 1987
  1387. 6. NAME SERVER IMPLEMENTATION
  1388. 6.1. Architecture
  1389. The optimal structure for the name server will depend on the host
  1390. operating system and whether the name server is integrated with resolver
  1391. operations, either by supporting recursive service, or by sharing its
  1392. database with a resolver. This section discusses implementation
  1393. considerations for a name server which shares a database with a
  1394. resolver, but most of these concerns are present in any name server.
  1395. 6.1.1. Control
  1396. A name server must employ multiple concurrent activities, whether they
  1397. are implemented as separate tasks in the host's OS or multiplexing
  1398. inside a single name server program. It is simply not acceptable for a
  1399. name server to block the service of UDP requests while it waits for TCP
  1400. data for refreshing or query activities. Similarly, a name server
  1401. should not attempt to provide recursive service without processing such
  1402. requests in parallel, though it may choose to serialize requests from a
  1403. single client, or to regard identical requests from the same client as
  1404. duplicates. A name server should not substantially delay requests while
  1405. it reloads a zone from master files or while it incorporates a newly
  1406. refreshed zone into its database.
  1407. 6.1.2. Database
  1408. While name server implementations are free to use any internal data
  1409. structures they choose, the suggested structure consists of three major
  1410. parts:
  1411. - A "catalog" data structure which lists the zones available to
  1412. this server, and a "pointer" to the zone data structure. The
  1413. main purpose of this structure is to find the nearest ancestor
  1414. zone, if any, for arriving standard queries.
  1415. - Separate data structures for each of the zones held by the
  1416. name server.
  1417. - A data structure for cached data. (or perhaps separate caches
  1418. for different classes)
  1419. All of these data structures can be implemented an identical tree
  1420. structure format, with different data chained off the nodes in different
  1421. parts: in the catalog the data is pointers to zones, while in the zone
  1422. and cache data structures, the data will be RRs. In designing the tree
  1423. framework the designer should recognize that query processing will need
  1424. to traverse the tree using case-insensitive label comparisons; and that
  1425. Mockapetris [Page 37]
  1426. RFC 1035 Domain Implementation and Specification November 1987
  1427. in real data, a few nodes have a very high branching factor (100-1000 or
  1428. more), but the vast majority have a very low branching factor (0-1).
  1429. One way to solve the case problem is to store the labels for each node
  1430. in two pieces: a standardized-case representation of the label where all
  1431. ASCII characters are in a single case, together with a bit mask that
  1432. denotes which characters are actually of a different case. The
  1433. branching factor diversity can be handled using a simple linked list for
  1434. a node until the branching factor exceeds some threshold, and
  1435. transitioning to a hash structure after the threshold is exceeded. In
  1436. any case, hash structures used to store tree sections must insure that
  1437. hash functions and procedures preserve the casing conventions of the
  1438. DNS.
  1439. The use of separate structures for the different parts of the database
  1440. is motivated by several factors:
  1441. - The catalog structure can be an almost static structure that
  1442. need change only when the system administrator changes the
  1443. zones supported by the server. This structure can also be
  1444. used to store parameters used to control refreshing
  1445. activities.
  1446. - The individual data structures for zones allow a zone to be
  1447. replaced simply by changing a pointer in the catalog. Zone
  1448. refresh operations can build a new structure and, when
  1449. complete, splice it into the database via a simple pointer
  1450. replacement. It is very important that when a zone is
  1451. refreshed, queries should not use old and new data
  1452. simultaneously.
  1453. - With the proper search procedures, authoritative data in zones
  1454. will always "hide", and hence take precedence over, cached
  1455. data.
  1456. - Errors in zone definitions that cause overlapping zones, etc.,
  1457. may cause erroneous responses to queries, but problem
  1458. determination is simplified, and the contents of one "bad"
  1459. zone can't corrupt another.
  1460. - Since the cache is most frequently updated, it is most
  1461. vulnerable to corruption during system restarts. It can also
  1462. become full of expired RR data. In either case, it can easily
  1463. be discarded without disturbing zone data.
  1464. A major aspect of database design is selecting a structure which allows
  1465. the name server to deal with crashes of the name server's host. State
  1466. information which a name server should save across system crashes
  1467. Mockapetris [Page 38]
  1468. RFC 1035 Domain Implementation and Specification November 1987
  1469. includes the catalog structure (including the state of refreshing for
  1470. each zone) and the zone data itself.
  1471. 6.1.3. Time
  1472. Both the TTL data for RRs and the timing data for refreshing activities
  1473. depends on 32 bit timers in units of seconds. Inside the database,
  1474. refresh timers and TTLs for cached data conceptually "count down", while
  1475. data in the zone stays with constant TTLs.
  1476. A recommended implementation strategy is to store time in two ways: as
  1477. a relative increment and as an absolute time. One way to do this is to
  1478. use positive 32 bit numbers for one type and negative numbers for the
  1479. other. The RRs in zones use relative times; the refresh timers and
  1480. cache data use absolute times. Absolute numbers are taken with respect
  1481. to some known origin and converted to relative values when placed in the
  1482. response to a query. When an absolute TTL is negative after conversion
  1483. to relative, then the data is expired and should be ignored.
  1484. 6.2. Standard query processing
  1485. The major algorithm for standard query processing is presented in
  1486. [RFC-1034].
  1487. When processing queries with QCLASS=*, or some other QCLASS which
  1488. matches multiple classes, the response should never be authoritative
  1489. unless the server can guarantee that the response covers all classes.
  1490. When composing a response, RRs which are to be inserted in the
  1491. additional section, but duplicate RRs in the answer or authority
  1492. sections, may be omitted from the additional section.
  1493. When a response is so long that truncation is required, the truncation
  1494. should start at the end of the response and work forward in the
  1495. datagram. Thus if there is any data for the authority section, the
  1496. answer section is guaranteed to be unique.
  1497. The MINIMUM value in the SOA should be used to set a floor on the TTL of
  1498. data distributed from a zone. This floor function should be done when
  1499. the data is copied into a response. This will allow future dynamic
  1500. update protocols to change the SOA MINIMUM field without ambiguous
  1501. semantics.
  1502. 6.3. Zone refresh and reload processing
  1503. In spite of a server's best efforts, it may be unable to load zone data
  1504. from a master file due to syntax errors, etc., or be unable to refresh a
  1505. zone within the its expiration parameter. In this case, the name server
  1506. Mockapetris [Page 39]
  1507. RFC 1035 Domain Implementation and Specification November 1987
  1508. should answer queries as if it were not supposed to possess the zone.
  1509. If a master is sending a zone out via AXFR, and a new version is created
  1510. during the transfer, the master should continue to send the old version
  1511. if possible. In any case, it should never send part of one version and
  1512. part of another. If completion is not possible, the master should reset
  1513. the connection on which the zone transfer is taking place.
  1514. 6.4. Inverse queries (Optional)
  1515. Inverse queries are an optional part of the DNS. Name servers are not
  1516. required to support any form of inverse queries. If a name server
  1517. receives an inverse query that it does not support, it returns an error
  1518. response with the "Not Implemented" error set in the header. While
  1519. inverse query support is optional, all name servers must be at least
  1520. able to return the error response.
  1521. 6.4.1. The contents of inverse queries and responses Inverse
  1522. queries reverse the mappings performed by standard query operations;
  1523. while a standard query maps a domain name to a resource, an inverse
  1524. query maps a resource to a domain name. For example, a standard query
  1525. might bind a domain name to a host address; the corresponding inverse
  1526. query binds the host address to a domain name.
  1527. Inverse queries take the form of a single RR in the answer section of
  1528. the message, with an empty question section. The owner name of the
  1529. query RR and its TTL are not significant. The response carries
  1530. questions in the question section which identify all names possessing
  1531. the query RR WHICH THE NAME SERVER KNOWS. Since no name server knows
  1532. about all of the domain name space, the response can never be assumed to
  1533. be complete. Thus inverse queries are primarily useful for database
  1534. management and debugging activities. Inverse queries are NOT an
  1535. acceptable method of mapping host addresses to host names; use the IN-
  1536. ADDR.ARPA domain instead.
  1537. Where possible, name servers should provide case-insensitive comparisons
  1538. for inverse queries. Thus an inverse query asking for an MX RR of
  1539. "Venera.isi.edu" should get the same response as a query for
  1540. "VENERA.ISI.EDU"; an inverse query for HINFO RR "IBM-PC UNIX" should
  1541. produce the same result as an inverse query for "IBM-pc unix". However,
  1542. this cannot be guaranteed because name servers may possess RRs that
  1543. contain character strings but the name server does not know that the
  1544. data is character.
  1545. When a name server processes an inverse query, it either returns:
  1546. 1. zero, one, or multiple domain names for the specified
  1547. resource as QNAMEs in the question section
  1548. Mockapetris [Page 40]
  1549. RFC 1035 Domain Implementation and Specification November 1987
  1550. 2. an error code indicating that the name server doesn't support
  1551. inverse mapping of the specified resource type.
  1552. When the response to an inverse query contains one or more QNAMEs, the
  1553. owner name and TTL of the RR in the answer section which defines the
  1554. inverse query is modified to exactly match an RR found at the first
  1555. QNAME.
  1556. RRs returned in the inverse queries cannot be cached using the same
  1557. mechanism as is used for the replies to standard queries. One reason
  1558. for this is that a name might have multiple RRs of the same type, and
  1559. only one would appear. For example, an inverse query for a single
  1560. address of a multiply homed host might create the impression that only
  1561. one address existed.
  1562. 6.4.2. Inverse query and response example The overall structure
  1563. of an inverse query for retrieving the domain name that corresponds to
  1564. Internet address 10.1.0.52 is shown below:
  1565. +-----------------------------------------+
  1566. Header | OPCODE=IQUERY, ID=997 |
  1567. +-----------------------------------------+
  1568. Question | <empty> |
  1569. +-----------------------------------------+
  1570. Answer | <anyname> A IN 10.1.0.52 |
  1571. +-----------------------------------------+
  1572. Authority | <empty> |
  1573. +-----------------------------------------+
  1574. Additional | <empty> |
  1575. +-----------------------------------------+
  1576. This query asks for a question whose answer is the Internet style
  1577. address 10.1.0.52. Since the owner name is not known, any domain name
  1578. can be used as a placeholder (and is ignored). A single octet of zero,
  1579. signifying the root, is usually used because it minimizes the length of
  1580. the message. The TTL of the RR is not significant. The response to
  1581. this query might be:
  1582. Mockapetris [Page 41]
  1583. RFC 1035 Domain Implementation and Specification November 1987
  1584. +-----------------------------------------+
  1585. Header | OPCODE=RESPONSE, ID=997 |
  1586. +-----------------------------------------+
  1587. Question |QTYPE=A, QCLASS=IN, QNAME=VENERA.ISI.EDU |
  1588. +-----------------------------------------+
  1589. Answer | VENERA.ISI.EDU A IN 10.1.0.52 |
  1590. +-----------------------------------------+
  1591. Authority | <empty> |
  1592. +-----------------------------------------+
  1593. Additional | <empty> |
  1594. +-----------------------------------------+
  1595. Note that the QTYPE in a response to an inverse query is the same as the
  1596. TYPE field in the answer section of the inverse query. Responses to
  1597. inverse queries may contain multiple questions when the inverse is not
  1598. unique. If the question section in the response is not empty, then the
  1599. RR in the answer section is modified to correspond to be an exact copy
  1600. of an RR at the first QNAME.
  1601. 6.4.3. Inverse query processing
  1602. Name servers that support inverse queries can support these operations
  1603. through exhaustive searches of their databases, but this becomes
  1604. impractical as the size of the database increases. An alternative
  1605. approach is to invert the database according to the search key.
  1606. For name servers that support multiple zones and a large amount of data,
  1607. the recommended approach is separate inversions for each zone. When a
  1608. particular zone is changed during a refresh, only its inversions need to
  1609. be redone.
  1610. Support for transfer of this type of inversion may be included in future
  1611. versions of the domain system, but is not supported in this version.
  1612. 6.5. Completion queries and responses
  1613. The optional completion services described in RFC-882 and RFC-883 have
  1614. been deleted. Redesigned services may become available in the future.
  1615. Mockapetris [Page 42]
  1616. RFC 1035 Domain Implementation and Specification November 1987
  1617. 7. RESOLVER IMPLEMENTATION
  1618. The top levels of the recommended resolver algorithm are discussed in
  1619. [RFC-1034]. This section discusses implementation details assuming the
  1620. database structure suggested in the name server implementation section
  1621. of this memo.
  1622. 7.1. Transforming a user request into a query
  1623. The first step a resolver takes is to transform the client's request,
  1624. stated in a format suitable to the local OS, into a search specification
  1625. for RRs at a specific name which match a specific QTYPE and QCLASS.
  1626. Where possible, the QTYPE and QCLASS should correspond to a single type
  1627. and a single class, because this makes the use of cached data much
  1628. simpler. The reason for this is that the presence of data of one type
  1629. in a cache doesn't confirm the existence or non-existence of data of
  1630. other types, hence the only way to be sure is to consult an
  1631. authoritative source. If QCLASS=* is used, then authoritative answers
  1632. won't be available.
  1633. Since a resolver must be able to multiplex multiple requests if it is to
  1634. perform its function efficiently, each pending request is usually
  1635. represented in some block of state information. This state block will
  1636. typically contain:
  1637. - A timestamp indicating the time the request began.
  1638. The timestamp is used to decide whether RRs in the database
  1639. can be used or are out of date. This timestamp uses the
  1640. absolute time format previously discussed for RR storage in
  1641. zones and caches. Note that when an RRs TTL indicates a
  1642. relative time, the RR must be timely, since it is part of a
  1643. zone. When the RR has an absolute time, it is part of a
  1644. cache, and the TTL of the RR is compared against the timestamp
  1645. for the start of the request.
  1646. Note that using the timestamp is superior to using a current
  1647. time, since it allows RRs with TTLs of zero to be entered in
  1648. the cache in the usual manner, but still used by the current
  1649. request, even after intervals of many seconds due to system
  1650. load, query retransmission timeouts, etc.
  1651. - Some sort of parameters to limit the amount of work which will
  1652. be performed for this request.
  1653. The amount of work which a resolver will do in response to a
  1654. client request must be limited to guard against errors in the
  1655. database, such as circular CNAME references, and operational
  1656. problems, such as network partition which prevents the
  1657. Mockapetris [Page 43]
  1658. RFC 1035 Domain Implementation and Specification November 1987
  1659. resolver from accessing the name servers it needs. While
  1660. local limits on the number of times a resolver will retransmit
  1661. a particular query to a particular name server address are
  1662. essential, the resolver should have a global per-request
  1663. counter to limit work on a single request. The counter should
  1664. be set to some initial value and decremented whenever the
  1665. resolver performs any action (retransmission timeout,
  1666. retransmission, etc.) If the counter passes zero, the request
  1667. is terminated with a temporary error.
  1668. Note that if the resolver structure allows one request to
  1669. start others in parallel, such as when the need to access a
  1670. name server for one request causes a parallel resolve for the
  1671. name server's addresses, the spawned request should be started
  1672. with a lower counter. This prevents circular references in
  1673. the database from starting a chain reaction of resolver
  1674. activity.
  1675. - The SLIST data structure discussed in [RFC-1034].
  1676. This structure keeps track of the state of a request if it
  1677. must wait for answers from foreign name servers.
  1678. 7.2. Sending the queries
  1679. As described in [RFC-1034], the basic task of the resolver is to
  1680. formulate a query which will answer the client's request and direct that
  1681. query to name servers which can provide the information. The resolver
  1682. will usually only have very strong hints about which servers to ask, in
  1683. the form of NS RRs, and may have to revise the query, in response to
  1684. CNAMEs, or revise the set of name servers the resolver is asking, in
  1685. response to delegation responses which point the resolver to name
  1686. servers closer to the desired information. In addition to the
  1687. information requested by the client, the resolver may have to call upon
  1688. its own services to determine the address of name servers it wishes to
  1689. contact.
  1690. In any case, the model used in this memo assumes that the resolver is
  1691. multiplexing attention between multiple requests, some from the client,
  1692. and some internally generated. Each request is represented by some
  1693. state information, and the desired behavior is that the resolver
  1694. transmit queries to name servers in a way that maximizes the probability
  1695. that the request is answered, minimizes the time that the request takes,
  1696. and avoids excessive transmissions. The key algorithm uses the state
  1697. information of the request to select the next name server address to
  1698. query, and also computes a timeout which will cause the next action
  1699. should a response not arrive. The next action will usually be a
  1700. transmission to some other server, but may be a temporary error to the
  1701. Mockapetris [Page 44]
  1702. RFC 1035 Domain Implementation and Specification November 1987
  1703. client.
  1704. The resolver always starts with a list of server names to query (SLIST).
  1705. This list will be all NS RRs which correspond to the nearest ancestor
  1706. zone that the resolver knows about. To avoid startup problems, the
  1707. resolver should have a set of default servers which it will ask should
  1708. it have no current NS RRs which are appropriate. The resolver then adds
  1709. to SLIST all of the known addresses for the name servers, and may start
  1710. parallel requests to acquire the addresses of the servers when the
  1711. resolver has the name, but no addresses, for the name servers.
  1712. To complete initialization of SLIST, the resolver attaches whatever
  1713. history information it has to the each address in SLIST. This will
  1714. usually consist of some sort of weighted averages for the response time
  1715. of the address, and the batting average of the address (i.e., how often
  1716. the address responded at all to the request). Note that this
  1717. information should be kept on a per address basis, rather than on a per
  1718. name server basis, because the response time and batting average of a
  1719. particular server may vary considerably from address to address. Note
  1720. also that this information is actually specific to a resolver address /
  1721. server address pair, so a resolver with multiple addresses may wish to
  1722. keep separate histories for each of its addresses. Part of this step
  1723. must deal with addresses which have no such history; in this case an
  1724. expected round trip time of 5-10 seconds should be the worst case, with
  1725. lower estimates for the same local network, etc.
  1726. Note that whenever a delegation is followed, the resolver algorithm
  1727. reinitializes SLIST.
  1728. The information establishes a partial ranking of the available name
  1729. server addresses. Each time an address is chosen and the state should
  1730. be altered to prevent its selection again until all other addresses have
  1731. been tried. The timeout for each transmission should be 50-100% greater
  1732. than the average predicted value to allow for variance in response.
  1733. Some fine points:
  1734. - The resolver may encounter a situation where no addresses are
  1735. available for any of the name servers named in SLIST, and
  1736. where the servers in the list are precisely those which would
  1737. normally be used to look up their own addresses. This
  1738. situation typically occurs when the glue address RRs have a
  1739. smaller TTL than the NS RRs marking delegation, or when the
  1740. resolver caches the result of a NS search. The resolver
  1741. should detect this condition and restart the search at the
  1742. next ancestor zone, or alternatively at the root.
  1743. Mockapetris [Page 45]
  1744. RFC 1035 Domain Implementation and Specification November 1987
  1745. - If a resolver gets a server error or other bizarre response
  1746. from a name server, it should remove it from SLIST, and may
  1747. wish to schedule an immediate transmission to the next
  1748. candidate server address.
  1749. 7.3. Processing responses
  1750. The first step in processing arriving response datagrams is to parse the
  1751. response. This procedure should include:
  1752. - Check the header for reasonableness. Discard datagrams which
  1753. are queries when responses are expected.
  1754. - Parse the sections of the message, and insure that all RRs are
  1755. correctly formatted.
  1756. - As an optional step, check the TTLs of arriving data looking
  1757. for RRs with excessively long TTLs. If a RR has an
  1758. excessively long TTL, say greater than 1 week, either discard
  1759. the whole response, or limit all TTLs in the response to 1
  1760. week.
  1761. The next step is to match the response to a current resolver request.
  1762. The recommended strategy is to do a preliminary matching using the ID
  1763. field in the domain header, and then to verify that the question section
  1764. corresponds to the information currently desired. This requires that
  1765. the transmission algorithm devote several bits of the domain ID field to
  1766. a request identifier of some sort. This step has several fine points:
  1767. - Some name servers send their responses from different
  1768. addresses than the one used to receive the query. That is, a
  1769. resolver cannot rely that a response will come from the same
  1770. address which it sent the corresponding query to. This name
  1771. server bug is typically encountered in UNIX systems.
  1772. - If the resolver retransmits a particular request to a name
  1773. server it should be able to use a response from any of the
  1774. transmissions. However, if it is using the response to sample
  1775. the round trip time to access the name server, it must be able
  1776. to determine which transmission matches the response (and keep
  1777. transmission times for each outgoing message), or only
  1778. calculate round trip times based on initial transmissions.
  1779. - A name server will occasionally not have a current copy of a
  1780. zone which it should have according to some NS RRs. The
  1781. resolver should simply remove the name server from the current
  1782. SLIST, and continue.
  1783. Mockapetris [Page 46]
  1784. RFC 1035 Domain Implementation and Specification November 1987
  1785. 7.4. Using the cache
  1786. In general, we expect a resolver to cache all data which it receives in
  1787. responses since it may be useful in answering future client requests.
  1788. However, there are several types of data which should not be cached:
  1789. - When several RRs of the same type are available for a
  1790. particular owner name, the resolver should either cache them
  1791. all or none at all. When a response is truncated, and a
  1792. resolver doesn't know whether it has a complete set, it should
  1793. not cache a possibly partial set of RRs.
  1794. - Cached data should never be used in preference to
  1795. authoritative data, so if caching would cause this to happen
  1796. the data should not be cached.
  1797. - The results of an inverse query should not be cached.
  1798. - The results of standard queries where the QNAME contains "*"
  1799. labels if the data might be used to construct wildcards. The
  1800. reason is that the cache does not necessarily contain existing
  1801. RRs or zone boundary information which is necessary to
  1802. restrict the application of the wildcard RRs.
  1803. - RR data in responses of dubious reliability. When a resolver
  1804. receives unsolicited responses or RR data other than that
  1805. requested, it should discard it without caching it. The basic
  1806. implication is that all sanity checks on a packet should be
  1807. performed before any of it is cached.
  1808. In a similar vein, when a resolver has a set of RRs for some name in a
  1809. response, and wants to cache the RRs, it should check its cache for
  1810. already existing RRs. Depending on the circumstances, either the data
  1811. in the response or the cache is preferred, but the two should never be
  1812. combined. If the data in the response is from authoritative data in the
  1813. answer section, it is always preferred.
  1814. 8. MAIL SUPPORT
  1815. The domain system defines a standard for mapping mailboxes into domain
  1816. names, and two methods for using the mailbox information to derive mail
  1817. routing information. The first method is called mail exchange binding
  1818. and the other method is mailbox binding. The mailbox encoding standard
  1819. and mail exchange binding are part of the DNS official protocol, and are
  1820. the recommended method for mail routing in the Internet. Mailbox
  1821. binding is an experimental feature which is still under development and
  1822. subject to change.
  1823. Mockapetris [Page 47]
  1824. RFC 1035 Domain Implementation and Specification November 1987
  1825. The mailbox encoding standard assumes a mailbox name of the form
  1826. "<local-part>@<mail-domain>". While the syntax allowed in each of these
  1827. sections varies substantially between the various mail internets, the
  1828. preferred syntax for the ARPA Internet is given in [RFC-822].
  1829. The DNS encodes the <local-part> as a single label, and encodes the
  1830. <mail-domain> as a domain name. The single label from the <local-part>
  1831. is prefaced to the domain name from <mail-domain> to form the domain
  1832. name corresponding to the mailbox. Thus the mailbox HOSTMASTER@SRI-
  1833. NIC.ARPA is mapped into the domain name HOSTMASTER.SRI-NIC.ARPA. If the
  1834. <local-part> contains dots or other special characters, its
  1835. representation in a master file will require the use of backslash
  1836. quoting to ensure that the domain name is properly encoded. For
  1837. example, the mailbox Action.domains@ISI.EDU would be represented as
  1838. Action\.domains.ISI.EDU.
  1839. 8.1. Mail exchange binding
  1840. Mail exchange binding uses the <mail-domain> part of a mailbox
  1841. specification to determine where mail should be sent. The <local-part>
  1842. is not even consulted. [RFC-974] specifies this method in detail, and
  1843. should be consulted before attempting to use mail exchange support.
  1844. One of the advantages of this method is that it decouples mail
  1845. destination naming from the hosts used to support mail service, at the
  1846. cost of another layer of indirection in the lookup function. However,
  1847. the addition layer should eliminate the need for complicated "%", "!",
  1848. etc encodings in <local-part>.
  1849. The essence of the method is that the <mail-domain> is used as a domain
  1850. name to locate type MX RRs which list hosts willing to accept mail for
  1851. <mail-domain>, together with preference values which rank the hosts
  1852. according to an order specified by the administrators for <mail-domain>.
  1853. In this memo, the <mail-domain> ISI.EDU is used in examples, together
  1854. with the hosts VENERA.ISI.EDU and VAXA.ISI.EDU as mail exchanges for
  1855. ISI.EDU. If a mailer had a message for Mockapetris@ISI.EDU, it would
  1856. route it by looking up MX RRs for ISI.EDU. The MX RRs at ISI.EDU name
  1857. VENERA.ISI.EDU and VAXA.ISI.EDU, and type A queries can find the host
  1858. addresses.
  1859. 8.2. Mailbox binding (Experimental)
  1860. In mailbox binding, the mailer uses the entire mail destination
  1861. specification to construct a domain name. The encoded domain name for
  1862. the mailbox is used as the QNAME field in a QTYPE=MAILB query.
  1863. Several outcomes are possible for this query:
  1864. Mockapetris [Page 48]
  1865. RFC 1035 Domain Implementation and Specification November 1987
  1866. 1. The query can return a name error indicating that the mailbox
  1867. does not exist as a domain name.
  1868. In the long term, this would indicate that the specified
  1869. mailbox doesn't exist. However, until the use of mailbox
  1870. binding is universal, this error condition should be
  1871. interpreted to mean that the organization identified by the
  1872. global part does not support mailbox binding. The
  1873. appropriate procedure is to revert to exchange binding at
  1874. this point.
  1875. 2. The query can return a Mail Rename (MR) RR.
  1876. The MR RR carries new mailbox specification in its RDATA
  1877. field. The mailer should replace the old mailbox with the
  1878. new one and retry the operation.
  1879. 3. The query can return a MB RR.
  1880. The MB RR carries a domain name for a host in its RDATA
  1881. field. The mailer should deliver the message to that host
  1882. via whatever protocol is applicable, e.g., b,SMTP.
  1883. 4. The query can return one or more Mail Group (MG) RRs.
  1884. This condition means that the mailbox was actually a mailing
  1885. list or mail group, rather than a single mailbox. Each MG RR
  1886. has a RDATA field that identifies a mailbox that is a member
  1887. of the group. The mailer should deliver a copy of the
  1888. message to each member.
  1889. 5. The query can return a MB RR as well as one or more MG RRs.
  1890. This condition means the the mailbox was actually a mailing
  1891. list. The mailer can either deliver the message to the host
  1892. specified by the MB RR, which will in turn do the delivery to
  1893. all members, or the mailer can use the MG RRs to do the
  1894. expansion itself.
  1895. In any of these cases, the response may include a Mail Information
  1896. (MINFO) RR. This RR is usually associated with a mail group, but is
  1897. legal with a MB. The MINFO RR identifies two mailboxes. One of these
  1898. identifies a responsible person for the original mailbox name. This
  1899. mailbox should be used for requests to be added to a mail group, etc.
  1900. The second mailbox name in the MINFO RR identifies a mailbox that should
  1901. receive error messages for mail failures. This is particularly
  1902. appropriate for mailing lists when errors in member names should be
  1903. reported to a person other than the one who sends a message to the list.
  1904. Mockapetris [Page 49]
  1905. RFC 1035 Domain Implementation and Specification November 1987
  1906. New fields may be added to this RR in the future.
  1907. 9. REFERENCES and BIBLIOGRAPHY
  1908. [Dyer 87] S. Dyer, F. Hsu, "Hesiod", Project Athena
  1909. Technical Plan - Name Service, April 1987, version 1.9.
  1910. Describes the fundamentals of the Hesiod name service.
  1911. [IEN-116] J. Postel, "Internet Name Server", IEN-116,
  1912. USC/Information Sciences Institute, August 1979.
  1913. A name service obsoleted by the Domain Name System, but
  1914. still in use.
  1915. [Quarterman 86] J. Quarterman, and J. Hoskins, "Notable Computer Networks",
  1916. Communications of the ACM, October 1986, volume 29, number
  1917. 10.
  1918. [RFC-742] K. Harrenstien, "NAME/FINGER", RFC-742, Network
  1919. Information Center, SRI International, December 1977.
  1920. [RFC-768] J. Postel, "User Datagram Protocol", RFC-768,
  1921. USC/Information Sciences Institute, August 1980.
  1922. [RFC-793] J. Postel, "Transmission Control Protocol", RFC-793,
  1923. USC/Information Sciences Institute, September 1981.
  1924. [RFC-799] D. Mills, "Internet Name Domains", RFC-799, COMSAT,
  1925. September 1981.
  1926. Suggests introduction of a hierarchy in place of a flat
  1927. name space for the Internet.
  1928. [RFC-805] J. Postel, "Computer Mail Meeting Notes", RFC-805,
  1929. USC/Information Sciences Institute, February 1982.
  1930. [RFC-810] E. Feinler, K. Harrenstien, Z. Su, and V. White, "DOD
  1931. Internet Host Table Specification", RFC-810, Network
  1932. Information Center, SRI International, March 1982.
  1933. Obsolete. See RFC-952.
  1934. [RFC-811] K. Harrenstien, V. White, and E. Feinler, "Hostnames
  1935. Server", RFC-811, Network Information Center, SRI
  1936. International, March 1982.
  1937. Mockapetris [Page 50]
  1938. RFC 1035 Domain Implementation and Specification November 1987
  1939. Obsolete. See RFC-953.
  1940. [RFC-812] K. Harrenstien, and V. White, "NICNAME/WHOIS", RFC-812,
  1941. Network Information Center, SRI International, March
  1942. 1982.
  1943. [RFC-819] Z. Su, and J. Postel, "The Domain Naming Convention for
  1944. Internet User Applications", RFC-819, Network
  1945. Information Center, SRI International, August 1982.
  1946. Early thoughts on the design of the domain system.
  1947. Current implementation is completely different.
  1948. [RFC-821] J. Postel, "Simple Mail Transfer Protocol", RFC-821,
  1949. USC/Information Sciences Institute, August 1980.
  1950. [RFC-830] Z. Su, "A Distributed System for Internet Name Service",
  1951. RFC-830, Network Information Center, SRI International,
  1952. October 1982.
  1953. Early thoughts on the design of the domain system.
  1954. Current implementation is completely different.
  1955. [RFC-882] P. Mockapetris, "Domain names - Concepts and
  1956. Facilities," RFC-882, USC/Information Sciences
  1957. Institute, November 1983.
  1958. Superceeded by this memo.
  1959. [RFC-883] P. Mockapetris, "Domain names - Implementation and
  1960. Specification," RFC-883, USC/Information Sciences
  1961. Institute, November 1983.
  1962. Superceeded by this memo.
  1963. [RFC-920] J. Postel and J. Reynolds, "Domain Requirements",
  1964. RFC-920, USC/Information Sciences Institute,
  1965. October 1984.
  1966. Explains the naming scheme for top level domains.
  1967. [RFC-952] K. Harrenstien, M. Stahl, E. Feinler, "DoD Internet Host
  1968. Table Specification", RFC-952, SRI, October 1985.
  1969. Specifies the format of HOSTS.TXT, the host/address
  1970. table replaced by the DNS.
  1971. Mockapetris [Page 51]
  1972. RFC 1035 Domain Implementation and Specification November 1987
  1973. [RFC-953] K. Harrenstien, M. Stahl, E. Feinler, "HOSTNAME Server",
  1974. RFC-953, SRI, October 1985.
  1975. This RFC contains the official specification of the
  1976. hostname server protocol, which is obsoleted by the DNS.
  1977. This TCP based protocol accesses information stored in
  1978. the RFC-952 format, and is used to obtain copies of the
  1979. host table.
  1980. [RFC-973] P. Mockapetris, "Domain System Changes and
  1981. Observations", RFC-973, USC/Information Sciences
  1982. Institute, January 1986.
  1983. Describes changes to RFC-882 and RFC-883 and reasons for
  1984. them.
  1985. [RFC-974] C. Partridge, "Mail routing and the domain system",
  1986. RFC-974, CSNET CIC BBN Labs, January 1986.
  1987. Describes the transition from HOSTS.TXT based mail
  1988. addressing to the more powerful MX system used with the
  1989. domain system.
  1990. [RFC-1001] NetBIOS Working Group, "Protocol standard for a NetBIOS
  1991. service on a TCP/UDP transport: Concepts and Methods",
  1992. RFC-1001, March 1987.
  1993. This RFC and RFC-1002 are a preliminary design for
  1994. NETBIOS on top of TCP/IP which proposes to base NetBIOS
  1995. name service on top of the DNS.
  1996. [RFC-1002] NetBIOS Working Group, "Protocol standard for a NetBIOS
  1997. service on a TCP/UDP transport: Detailed
  1998. Specifications", RFC-1002, March 1987.
  1999. [RFC-1010] J. Reynolds, and J. Postel, "Assigned Numbers", RFC-1010,
  2000. USC/Information Sciences Institute, May 1987.
  2001. Contains socket numbers and mnemonics for host names,
  2002. operating systems, etc.
  2003. [RFC-1031] W. Lazear, "MILNET Name Domain Transition", RFC-1031,
  2004. November 1987.
  2005. Describes a plan for converting the MILNET to the DNS.
  2006. [RFC-1032] M. Stahl, "Establishing a Domain - Guidelines for
  2007. Administrators", RFC-1032, November 1987.
  2008. Mockapetris [Page 52]
  2009. RFC 1035 Domain Implementation and Specification November 1987
  2010. Describes the registration policies used by the NIC to
  2011. administer the top level domains and delegate subzones.
  2012. [RFC-1033] M. Lottor, "Domain Administrators Operations Guide",
  2013. RFC-1033, November 1987.
  2014. A cookbook for domain administrators.
  2015. [Solomon 82] M. Solomon, L. Landweber, and D. Neuhengen, "The CSNET
  2016. Name Server", Computer Networks, vol 6, nr 3, July 1982.
  2017. Describes a name service for CSNET which is independent
  2018. from the DNS and DNS use in the CSNET.
  2019. Mockapetris [Page 53]
  2020. RFC 1035 Domain Implementation and Specification November 1987
  2021. Index
  2022. * 13
  2023. ; 33, 35
  2024. <character-string> 35
  2025. <domain-name> 34
  2026. @ 35
  2027. \ 35
  2028. A 12
  2029. Byte order 8
  2030. CH 13
  2031. Character case 9
  2032. CLASS 11
  2033. CNAME 12
  2034. Completion 42
  2035. CS 13
  2036. Hesiod 13
  2037. HINFO 12
  2038. HS 13
  2039. IN 13
  2040. IN-ADDR.ARPA domain 22
  2041. Inverse queries 40
  2042. Mailbox names 47
  2043. MB 12
  2044. MD 12
  2045. MF 12
  2046. MG 12
  2047. MINFO 12
  2048. MINIMUM 20
  2049. MR 12
  2050. MX 12
  2051. NS 12
  2052. NULL 12
  2053. Port numbers 32
  2054. Primary server 5
  2055. PTR 12, 18
  2056. Mockapetris [Page 54]
  2057. RFC 1035 Domain Implementation and Specification November 1987
  2058. QCLASS 13
  2059. QTYPE 12
  2060. RDATA 12
  2061. RDLENGTH 11
  2062. Secondary server 5
  2063. SOA 12
  2064. Stub resolvers 7
  2065. TCP 32
  2066. TXT 12
  2067. TYPE 11
  2068. UDP 32
  2069. WKS 12
  2070. Mockapetris [Page 55]