/contrib/bind9/doc/arm/Bv9ARM-book.xml

https://bitbucket.org/freebsd/freebsd-head/ · XML · 16541 lines · 15584 code · 916 blank · 41 comment · 0 complexity · 229a224015246795a39e20aab94ec4c8 MD5 · raw file

Large files are truncated click here to view the full file

  1. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY mdash "&#8212;">]>
  4. <!--
  5. - Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
  6. - Copyright (C) 2000-2003 Internet Software Consortium.
  7. -
  8. - Permission to use, copy, modify, and/or distribute this software for any
  9. - purpose with or without fee is hereby granted, provided that the above
  10. - copyright notice and this permission notice appear in all copies.
  11. -
  12. - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  13. - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14. - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  15. - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  16. - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  17. - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18. - PERFORMANCE OF THIS SOFTWARE.
  19. -->
  20. <!-- File: $Id$ -->
  21. <book xmlns:xi="http://www.w3.org/2001/XInclude">
  22. <title>BIND 9 Administrator Reference Manual</title>
  23. <bookinfo>
  24. <copyright>
  25. <year>2004</year>
  26. <year>2005</year>
  27. <year>2006</year>
  28. <year>2007</year>
  29. <year>2008</year>
  30. <year>2009</year>
  31. <year>2010</year>
  32. <year>2011</year>
  33. <year>2012</year>
  34. <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
  35. </copyright>
  36. <copyright>
  37. <year>2000</year>
  38. <year>2001</year>
  39. <year>2002</year>
  40. <year>2003</year>
  41. <holder>Internet Software Consortium.</holder>
  42. </copyright>
  43. </bookinfo>
  44. <chapter id="Bv9ARM.ch01">
  45. <title>Introduction</title>
  46. <para>
  47. The Internet Domain Name System (<acronym>DNS</acronym>)
  48. consists of the syntax
  49. to specify the names of entities in the Internet in a hierarchical
  50. manner, the rules used for delegating authority over names, and the
  51. system implementation that actually maps names to Internet
  52. addresses. <acronym>DNS</acronym> data is maintained in a
  53. group of distributed
  54. hierarchical databases.
  55. </para>
  56. <sect1>
  57. <title>Scope of Document</title>
  58. <para>
  59. The Berkeley Internet Name Domain
  60. (<acronym>BIND</acronym>) implements a
  61. domain name server for a number of operating systems. This
  62. document provides basic information about the installation and
  63. care of the Internet Systems Consortium (<acronym>ISC</acronym>)
  64. <acronym>BIND</acronym> version 9 software package for
  65. system administrators.
  66. </para>
  67. <para>
  68. This version of the manual corresponds to BIND version 9.8.
  69. </para>
  70. </sect1>
  71. <sect1>
  72. <title>Organization of This Document</title>
  73. <para>
  74. In this document, <emphasis>Chapter 1</emphasis> introduces
  75. the basic <acronym>DNS</acronym> and <acronym>BIND</acronym> concepts. <emphasis>Chapter 2</emphasis>
  76. describes resource requirements for running <acronym>BIND</acronym> in various
  77. environments. Information in <emphasis>Chapter 3</emphasis> is
  78. <emphasis>task-oriented</emphasis> in its presentation and is
  79. organized functionally, to aid in the process of installing the
  80. <acronym>BIND</acronym> 9 software. The task-oriented
  81. section is followed by
  82. <emphasis>Chapter 4</emphasis>, which contains more advanced
  83. concepts that the system administrator may need for implementing
  84. certain options. <emphasis>Chapter 5</emphasis>
  85. describes the <acronym>BIND</acronym> 9 lightweight
  86. resolver. The contents of <emphasis>Chapter 6</emphasis> are
  87. organized as in a reference manual to aid in the ongoing
  88. maintenance of the software. <emphasis>Chapter 7</emphasis> addresses
  89. security considerations, and
  90. <emphasis>Chapter 8</emphasis> contains troubleshooting help. The
  91. main body of the document is followed by several
  92. <emphasis>appendices</emphasis> which contain useful reference
  93. information, such as a <emphasis>bibliography</emphasis> and
  94. historic information related to <acronym>BIND</acronym>
  95. and the Domain Name
  96. System.
  97. </para>
  98. </sect1>
  99. <sect1>
  100. <title>Conventions Used in This Document</title>
  101. <para>
  102. In this document, we use the following general typographic
  103. conventions:
  104. </para>
  105. <informaltable>
  106. <tgroup cols="2">
  107. <colspec colname="1" colnum="1" colwidth="3.000in"/>
  108. <colspec colname="2" colnum="2" colwidth="2.625in"/>
  109. <tbody>
  110. <row>
  111. <entry colname="1">
  112. <para>
  113. <emphasis>To describe:</emphasis>
  114. </para>
  115. </entry>
  116. <entry colname="2">
  117. <para>
  118. <emphasis>We use the style:</emphasis>
  119. </para>
  120. </entry>
  121. </row>
  122. <row>
  123. <entry colname="1">
  124. <para>
  125. a pathname, filename, URL, hostname,
  126. mailing list name, or new term or concept
  127. </para>
  128. </entry>
  129. <entry colname="2">
  130. <para>
  131. <filename>Fixed width</filename>
  132. </para>
  133. </entry>
  134. </row>
  135. <row>
  136. <entry colname="1">
  137. <para>
  138. literal user
  139. input
  140. </para>
  141. </entry>
  142. <entry colname="2">
  143. <para>
  144. <userinput>Fixed Width Bold</userinput>
  145. </para>
  146. </entry>
  147. </row>
  148. <row>
  149. <entry colname="1">
  150. <para>
  151. program output
  152. </para>
  153. </entry>
  154. <entry colname="2">
  155. <para>
  156. <computeroutput>Fixed Width</computeroutput>
  157. </para>
  158. </entry>
  159. </row>
  160. </tbody>
  161. </tgroup>
  162. </informaltable>
  163. <para>
  164. The following conventions are used in descriptions of the
  165. <acronym>BIND</acronym> configuration file:<informaltable colsep="0" frame="all" rowsep="0">
  166. <tgroup cols="2" colsep="0" rowsep="0" tgroupstyle="2Level-table">
  167. <colspec colname="1" colnum="1" colsep="0" colwidth="3.000in"/>
  168. <colspec colname="2" colnum="2" colsep="0" colwidth="2.625in"/>
  169. <tbody>
  170. <row rowsep="0">
  171. <entry colname="1" colsep="1" rowsep="1">
  172. <para>
  173. <emphasis>To describe:</emphasis>
  174. </para>
  175. </entry>
  176. <entry colname="2" rowsep="1">
  177. <para>
  178. <emphasis>We use the style:</emphasis>
  179. </para>
  180. </entry>
  181. </row>
  182. <row rowsep="0">
  183. <entry colname="1" colsep="1" rowsep="1">
  184. <para>
  185. keywords
  186. </para>
  187. </entry>
  188. <entry colname="2" rowsep="1">
  189. <para>
  190. <literal>Fixed Width</literal>
  191. </para>
  192. </entry>
  193. </row>
  194. <row rowsep="0">
  195. <entry colname="1" colsep="1" rowsep="1">
  196. <para>
  197. variables
  198. </para>
  199. </entry>
  200. <entry colname="2" rowsep="1">
  201. <para>
  202. <varname>Fixed Width</varname>
  203. </para>
  204. </entry>
  205. </row>
  206. <row rowsep="0">
  207. <entry colname="1" colsep="1">
  208. <para>
  209. Optional input
  210. </para>
  211. </entry>
  212. <entry colname="2">
  213. <para>
  214. <optional>Text is enclosed in square brackets</optional>
  215. </para>
  216. </entry>
  217. </row>
  218. </tbody>
  219. </tgroup>
  220. </informaltable>
  221. </para>
  222. </sect1>
  223. <sect1>
  224. <title>The Domain Name System (<acronym>DNS</acronym>)</title>
  225. <para>
  226. The purpose of this document is to explain the installation
  227. and upkeep of the <acronym>BIND</acronym> (Berkeley Internet
  228. Name Domain) software package, and we
  229. begin by reviewing the fundamentals of the Domain Name System
  230. (<acronym>DNS</acronym>) as they relate to <acronym>BIND</acronym>.
  231. </para>
  232. <sect2>
  233. <title>DNS Fundamentals</title>
  234. <para>
  235. The Domain Name System (DNS) is a hierarchical, distributed
  236. database. It stores information for mapping Internet host names to
  237. IP
  238. addresses and vice versa, mail routing information, and other data
  239. used by Internet applications.
  240. </para>
  241. <para>
  242. Clients look up information in the DNS by calling a
  243. <emphasis>resolver</emphasis> library, which sends queries to one or
  244. more <emphasis>name servers</emphasis> and interprets the responses.
  245. The <acronym>BIND</acronym> 9 software distribution
  246. contains a
  247. name server, <command>named</command>, and a resolver
  248. library, <command>liblwres</command>. The older
  249. <command>libbind</command> resolver library is also available
  250. from ISC as a separate download.
  251. </para>
  252. </sect2><sect2>
  253. <title>Domains and Domain Names</title>
  254. <para>
  255. The data stored in the DNS is identified by <emphasis>domain names</emphasis> that are organized as a tree according to
  256. organizational or administrative boundaries. Each node of the tree,
  257. called a <emphasis>domain</emphasis>, is given a label. The domain
  258. name of the
  259. node is the concatenation of all the labels on the path from the
  260. node to the <emphasis>root</emphasis> node. This is represented
  261. in written form as a string of labels listed from right to left and
  262. separated by dots. A label need only be unique within its parent
  263. domain.
  264. </para>
  265. <para>
  266. For example, a domain name for a host at the
  267. company <emphasis>Example, Inc.</emphasis> could be
  268. <literal>ourhost.example.com</literal>,
  269. where <literal>com</literal> is the
  270. top level domain to which
  271. <literal>ourhost.example.com</literal> belongs,
  272. <literal>example</literal> is
  273. a subdomain of <literal>com</literal>, and
  274. <literal>ourhost</literal> is the
  275. name of the host.
  276. </para>
  277. <para>
  278. For administrative purposes, the name space is partitioned into
  279. areas called <emphasis>zones</emphasis>, each starting at a node and
  280. extending down to the leaf nodes or to nodes where other zones
  281. start.
  282. The data for each zone is stored in a <emphasis>name server</emphasis>, which answers queries about the zone using the
  283. <emphasis>DNS protocol</emphasis>.
  284. </para>
  285. <para>
  286. The data associated with each domain name is stored in the
  287. form of <emphasis>resource records</emphasis> (<acronym>RR</acronym>s).
  288. Some of the supported resource record types are described in
  289. <xref linkend="types_of_resource_records_and_when_to_use_them"/>.
  290. </para>
  291. <para>
  292. For more detailed information about the design of the DNS and
  293. the DNS protocol, please refer to the standards documents listed in
  294. <xref linkend="rfcs"/>.
  295. </para>
  296. </sect2>
  297. <sect2>
  298. <title>Zones</title>
  299. <para>
  300. To properly operate a name server, it is important to understand
  301. the difference between a <emphasis>zone</emphasis>
  302. and a <emphasis>domain</emphasis>.
  303. </para>
  304. <para>
  305. As stated previously, a zone is a point of delegation in
  306. the <acronym>DNS</acronym> tree. A zone consists of
  307. those contiguous parts of the domain
  308. tree for which a name server has complete information and over which
  309. it has authority. It contains all domain names from a certain point
  310. downward in the domain tree except those which are delegated to
  311. other zones. A delegation point is marked by one or more
  312. <emphasis>NS records</emphasis> in the
  313. parent zone, which should be matched by equivalent NS records at
  314. the root of the delegated zone.
  315. </para>
  316. <para>
  317. For instance, consider the <literal>example.com</literal>
  318. domain which includes names
  319. such as <literal>host.aaa.example.com</literal> and
  320. <literal>host.bbb.example.com</literal> even though
  321. the <literal>example.com</literal> zone includes
  322. only delegations for the <literal>aaa.example.com</literal> and
  323. <literal>bbb.example.com</literal> zones. A zone can
  324. map
  325. exactly to a single domain, but could also include only part of a
  326. domain, the rest of which could be delegated to other
  327. name servers. Every name in the <acronym>DNS</acronym>
  328. tree is a
  329. <emphasis>domain</emphasis>, even if it is
  330. <emphasis>terminal</emphasis>, that is, has no
  331. <emphasis>subdomains</emphasis>. Every subdomain is a domain and
  332. every domain except the root is also a subdomain. The terminology is
  333. not intuitive and we suggest that you read RFCs 1033, 1034 and 1035
  334. to
  335. gain a complete understanding of this difficult and subtle
  336. topic.
  337. </para>
  338. <para>
  339. Though <acronym>BIND</acronym> is called a "domain name
  340. server",
  341. it deals primarily in terms of zones. The master and slave
  342. declarations in the <filename>named.conf</filename> file
  343. specify
  344. zones, not domains. When you ask some other site if it is willing to
  345. be a slave server for your <emphasis>domain</emphasis>, you are
  346. actually asking for slave service for some collection of zones.
  347. </para>
  348. </sect2>
  349. <sect2>
  350. <title>Authoritative Name Servers</title>
  351. <para>
  352. Each zone is served by at least
  353. one <emphasis>authoritative name server</emphasis>,
  354. which contains the complete data for the zone.
  355. To make the DNS tolerant of server and network failures,
  356. most zones have two or more authoritative servers, on
  357. different networks.
  358. </para>
  359. <para>
  360. Responses from authoritative servers have the "authoritative
  361. answer" (AA) bit set in the response packets. This makes them
  362. easy to identify when debugging DNS configurations using tools like
  363. <command>dig</command> (<xref linkend="diagnostic_tools"/>).
  364. </para>
  365. <sect3>
  366. <title>The Primary Master</title>
  367. <para>
  368. The authoritative server where the master copy of the zone
  369. data is maintained is called the
  370. <emphasis>primary master</emphasis> server, or simply the
  371. <emphasis>primary</emphasis>. Typically it loads the zone
  372. contents from some local file edited by humans or perhaps
  373. generated mechanically from some other local file which is
  374. edited by humans. This file is called the
  375. <emphasis>zone file</emphasis> or
  376. <emphasis>master file</emphasis>.
  377. </para>
  378. <para>
  379. In some cases, however, the master file may not be edited
  380. by humans at all, but may instead be the result of
  381. <emphasis>dynamic update</emphasis> operations.
  382. </para>
  383. </sect3>
  384. <sect3>
  385. <title>Slave Servers</title>
  386. <para>
  387. The other authoritative servers, the <emphasis>slave</emphasis>
  388. servers (also known as <emphasis>secondary</emphasis> servers)
  389. load
  390. the zone contents from another server using a replication process
  391. known as a <emphasis>zone transfer</emphasis>. Typically the data
  392. are
  393. transferred directly from the primary master, but it is also
  394. possible
  395. to transfer it from another slave. In other words, a slave server
  396. may itself act as a master to a subordinate slave server.
  397. </para>
  398. </sect3>
  399. <sect3>
  400. <title>Stealth Servers</title>
  401. <para>
  402. Usually all of the zone's authoritative servers are listed in
  403. NS records in the parent zone. These NS records constitute
  404. a <emphasis>delegation</emphasis> of the zone from the parent.
  405. The authoritative servers are also listed in the zone file itself,
  406. at the <emphasis>top level</emphasis> or <emphasis>apex</emphasis>
  407. of the zone. You can list servers in the zone's top-level NS
  408. records that are not in the parent's NS delegation, but you cannot
  409. list servers in the parent's delegation that are not present at
  410. the zone's top level.
  411. </para>
  412. <para>
  413. A <emphasis>stealth server</emphasis> is a server that is
  414. authoritative for a zone but is not listed in that zone's NS
  415. records. Stealth servers can be used for keeping a local copy of
  416. a
  417. zone to speed up access to the zone's records or to make sure that
  418. the
  419. zone is available even if all the "official" servers for the zone
  420. are
  421. inaccessible.
  422. </para>
  423. <para>
  424. A configuration where the primary master server itself is a
  425. stealth server is often referred to as a "hidden primary"
  426. configuration. One use for this configuration is when the primary
  427. master
  428. is behind a firewall and therefore unable to communicate directly
  429. with the outside world.
  430. </para>
  431. </sect3>
  432. </sect2>
  433. <sect2>
  434. <title>Caching Name Servers</title>
  435. <!--
  436. - Terminology here is inconsistent. Probably ought to
  437. - convert to using "recursive name server" everywhere
  438. - with just a note about "caching" terminology.
  439. -->
  440. <para>
  441. The resolver libraries provided by most operating systems are
  442. <emphasis>stub resolvers</emphasis>, meaning that they are not
  443. capable of
  444. performing the full DNS resolution process by themselves by talking
  445. directly to the authoritative servers. Instead, they rely on a
  446. local
  447. name server to perform the resolution on their behalf. Such a
  448. server
  449. is called a <emphasis>recursive</emphasis> name server; it performs
  450. <emphasis>recursive lookups</emphasis> for local clients.
  451. </para>
  452. <para>
  453. To improve performance, recursive servers cache the results of
  454. the lookups they perform. Since the processes of recursion and
  455. caching are intimately connected, the terms
  456. <emphasis>recursive server</emphasis> and
  457. <emphasis>caching server</emphasis> are often used synonymously.
  458. </para>
  459. <para>
  460. The length of time for which a record may be retained in
  461. the cache of a caching name server is controlled by the
  462. Time To Live (TTL) field associated with each resource record.
  463. </para>
  464. <sect3>
  465. <title>Forwarding</title>
  466. <para>
  467. Even a caching name server does not necessarily perform
  468. the complete recursive lookup itself. Instead, it can
  469. <emphasis>forward</emphasis> some or all of the queries
  470. that it cannot satisfy from its cache to another caching name
  471. server,
  472. commonly referred to as a <emphasis>forwarder</emphasis>.
  473. </para>
  474. <para>
  475. There may be one or more forwarders,
  476. and they are queried in turn until the list is exhausted or an
  477. answer
  478. is found. Forwarders are typically used when you do not
  479. wish all the servers at a given site to interact directly with the
  480. rest of
  481. the Internet servers. A typical scenario would involve a number
  482. of internal <acronym>DNS</acronym> servers and an
  483. Internet firewall. Servers unable
  484. to pass packets through the firewall would forward to the server
  485. that can do it, and that server would query the Internet <acronym>DNS</acronym> servers
  486. on the internal server's behalf.
  487. </para>
  488. </sect3>
  489. </sect2>
  490. <sect2>
  491. <title>Name Servers in Multiple Roles</title>
  492. <para>
  493. The <acronym>BIND</acronym> name server can
  494. simultaneously act as
  495. a master for some zones, a slave for other zones, and as a caching
  496. (recursive) server for a set of local clients.
  497. </para>
  498. <para>
  499. However, since the functions of authoritative name service
  500. and caching/recursive name service are logically separate, it is
  501. often advantageous to run them on separate server machines.
  502. A server that only provides authoritative name service
  503. (an <emphasis>authoritative-only</emphasis> server) can run with
  504. recursion disabled, improving reliability and security.
  505. A server that is not authoritative for any zones and only provides
  506. recursive service to local
  507. clients (a <emphasis>caching-only</emphasis> server)
  508. does not need to be reachable from the Internet at large and can
  509. be placed inside a firewall.
  510. </para>
  511. </sect2>
  512. </sect1>
  513. </chapter>
  514. <chapter id="Bv9ARM.ch02">
  515. <title><acronym>BIND</acronym> Resource Requirements</title>
  516. <sect1>
  517. <title>Hardware requirements</title>
  518. <para>
  519. <acronym>DNS</acronym> hardware requirements have
  520. traditionally been quite modest.
  521. For many installations, servers that have been pensioned off from
  522. active duty have performed admirably as <acronym>DNS</acronym> servers.
  523. </para>
  524. <para>
  525. The DNSSEC features of <acronym>BIND</acronym> 9
  526. may prove to be quite
  527. CPU intensive however, so organizations that make heavy use of these
  528. features may wish to consider larger systems for these applications.
  529. <acronym>BIND</acronym> 9 is fully multithreaded, allowing
  530. full utilization of
  531. multiprocessor systems for installations that need it.
  532. </para>
  533. </sect1>
  534. <sect1>
  535. <title>CPU Requirements</title>
  536. <para>
  537. CPU requirements for <acronym>BIND</acronym> 9 range from
  538. i486-class machines
  539. for serving of static zones without caching, to enterprise-class
  540. machines if you intend to process many dynamic updates and DNSSEC
  541. signed zones, serving many thousands of queries per second.
  542. </para>
  543. </sect1>
  544. <sect1>
  545. <title>Memory Requirements</title>
  546. <para>
  547. The memory of the server has to be large enough to fit the
  548. cache and zones loaded off disk. The <command>max-cache-size</command>
  549. option can be used to limit the amount of memory used by the cache,
  550. at the expense of reducing cache hit rates and causing more <acronym>DNS</acronym>
  551. traffic.
  552. Additionally, if additional section caching
  553. (<xref linkend="acache"/>) is enabled,
  554. the <command>max-acache-size</command> option can be used to
  555. limit the amount
  556. of memory used by the mechanism.
  557. It is still good practice to have enough memory to load
  558. all zone and cache data into memory &mdash; unfortunately, the best
  559. way
  560. to determine this for a given installation is to watch the name server
  561. in operation. After a few weeks the server process should reach
  562. a relatively stable size where entries are expiring from the cache as
  563. fast as they are being inserted.
  564. </para>
  565. <!--
  566. - Add something here about leaving overhead for attacks?
  567. - How much overhead? Percentage?
  568. -->
  569. </sect1>
  570. <sect1>
  571. <title>Name Server Intensive Environment Issues</title>
  572. <para>
  573. For name server intensive environments, there are two alternative
  574. configurations that may be used. The first is where clients and
  575. any second-level internal name servers query a main name server, which
  576. has enough memory to build a large cache. This approach minimizes
  577. the bandwidth used by external name lookups. The second alternative
  578. is to set up second-level internal name servers to make queries
  579. independently.
  580. In this configuration, none of the individual machines needs to
  581. have as much memory or CPU power as in the first alternative, but
  582. this has the disadvantage of making many more external queries,
  583. as none of the name servers share their cached data.
  584. </para>
  585. </sect1>
  586. <sect1>
  587. <title>Supported Operating Systems</title>
  588. <para>
  589. ISC <acronym>BIND</acronym> 9 compiles and runs on a large
  590. number
  591. of Unix-like operating systems and on
  592. Microsoft Windows Server 2003 and 2008, and Windows XP and Vista.
  593. For an up-to-date
  594. list of supported systems, see the README file in the top level
  595. directory
  596. of the BIND 9 source distribution.
  597. </para>
  598. </sect1>
  599. </chapter>
  600. <chapter id="Bv9ARM.ch03">
  601. <title>Name Server Configuration</title>
  602. <para>
  603. In this chapter we provide some suggested configurations along
  604. with guidelines for their use. We suggest reasonable values for
  605. certain option settings.
  606. </para>
  607. <sect1 id="sample_configuration">
  608. <title>Sample Configurations</title>
  609. <sect2>
  610. <title>A Caching-only Name Server</title>
  611. <para>
  612. The following sample configuration is appropriate for a caching-only
  613. name server for use by clients internal to a corporation. All
  614. queries
  615. from outside clients are refused using the <command>allow-query</command>
  616. option. Alternatively, the same effect could be achieved using
  617. suitable
  618. firewall rules.
  619. </para>
  620. <programlisting>
  621. // Two corporate subnets we wish to allow queries from.
  622. acl corpnets { 192.168.4.0/24; 192.168.7.0/24; };
  623. options {
  624. // Working directory
  625. directory "/etc/namedb";
  626. allow-query { corpnets; };
  627. };
  628. // Provide a reverse mapping for the loopback
  629. // address 127.0.0.1
  630. zone "0.0.127.in-addr.arpa" {
  631. type master;
  632. file "localhost.rev";
  633. notify no;
  634. };
  635. </programlisting>
  636. </sect2>
  637. <sect2>
  638. <title>An Authoritative-only Name Server</title>
  639. <para>
  640. This sample configuration is for an authoritative-only server
  641. that is the master server for "<filename>example.com</filename>"
  642. and a slave for the subdomain "<filename>eng.example.com</filename>".
  643. </para>
  644. <programlisting>
  645. options {
  646. // Working directory
  647. directory "/etc/namedb";
  648. // Do not allow access to cache
  649. allow-query-cache { none; };
  650. // This is the default
  651. allow-query { any; };
  652. // Do not provide recursive service
  653. recursion no;
  654. };
  655. // Provide a reverse mapping for the loopback
  656. // address 127.0.0.1
  657. zone "0.0.127.in-addr.arpa" {
  658. type master;
  659. file "localhost.rev";
  660. notify no;
  661. };
  662. // We are the master server for example.com
  663. zone "example.com" {
  664. type master;
  665. file "example.com.db";
  666. // IP addresses of slave servers allowed to
  667. // transfer example.com
  668. allow-transfer {
  669. 192.168.4.14;
  670. 192.168.5.53;
  671. };
  672. };
  673. // We are a slave server for eng.example.com
  674. zone "eng.example.com" {
  675. type slave;
  676. file "eng.example.com.bk";
  677. // IP address of eng.example.com master server
  678. masters { 192.168.4.12; };
  679. };
  680. </programlisting>
  681. </sect2>
  682. </sect1>
  683. <sect1>
  684. <title>Load Balancing</title>
  685. <!--
  686. - Add explanation of why load balancing is fragile at best
  687. - and completely pointless in the general case.
  688. -->
  689. <para>
  690. A primitive form of load balancing can be achieved in
  691. the <acronym>DNS</acronym> by using multiple records
  692. (such as multiple A records) for one name.
  693. </para>
  694. <para>
  695. For example, if you have three WWW servers with network addresses
  696. of 10.0.0.1, 10.0.0.2 and 10.0.0.3, a set of records such as the
  697. following means that clients will connect to each machine one third
  698. of the time:
  699. </para>
  700. <informaltable colsep="0" rowsep="0">
  701. <tgroup cols="5" colsep="0" rowsep="0" tgroupstyle="2Level-table">
  702. <colspec colname="1" colnum="1" colsep="0" colwidth="0.875in"/>
  703. <colspec colname="2" colnum="2" colsep="0" colwidth="0.500in"/>
  704. <colspec colname="3" colnum="3" colsep="0" colwidth="0.750in"/>
  705. <colspec colname="4" colnum="4" colsep="0" colwidth="0.750in"/>
  706. <colspec colname="5" colnum="5" colsep="0" colwidth="2.028in"/>
  707. <tbody>
  708. <row rowsep="0">
  709. <entry colname="1">
  710. <para>
  711. Name
  712. </para>
  713. </entry>
  714. <entry colname="2">
  715. <para>
  716. TTL
  717. </para>
  718. </entry>
  719. <entry colname="3">
  720. <para>
  721. CLASS
  722. </para>
  723. </entry>
  724. <entry colname="4">
  725. <para>
  726. TYPE
  727. </para>
  728. </entry>
  729. <entry colname="5">
  730. <para>
  731. Resource Record (RR) Data
  732. </para>
  733. </entry>
  734. </row>
  735. <row rowsep="0">
  736. <entry colname="1">
  737. <para>
  738. <literal>www</literal>
  739. </para>
  740. </entry>
  741. <entry colname="2">
  742. <para>
  743. <literal>600</literal>
  744. </para>
  745. </entry>
  746. <entry colname="3">
  747. <para>
  748. <literal>IN</literal>
  749. </para>
  750. </entry>
  751. <entry colname="4">
  752. <para>
  753. <literal>A</literal>
  754. </para>
  755. </entry>
  756. <entry colname="5">
  757. <para>
  758. <literal>10.0.0.1</literal>
  759. </para>
  760. </entry>
  761. </row>
  762. <row rowsep="0">
  763. <entry colname="1">
  764. <para/>
  765. </entry>
  766. <entry colname="2">
  767. <para>
  768. <literal>600</literal>
  769. </para>
  770. </entry>
  771. <entry colname="3">
  772. <para>
  773. <literal>IN</literal>
  774. </para>
  775. </entry>
  776. <entry colname="4">
  777. <para>
  778. <literal>A</literal>
  779. </para>
  780. </entry>
  781. <entry colname="5">
  782. <para>
  783. <literal>10.0.0.2</literal>
  784. </para>
  785. </entry>
  786. </row>
  787. <row rowsep="0">
  788. <entry colname="1">
  789. <para/>
  790. </entry>
  791. <entry colname="2">
  792. <para>
  793. <literal>600</literal>
  794. </para>
  795. </entry>
  796. <entry colname="3">
  797. <para>
  798. <literal>IN</literal>
  799. </para>
  800. </entry>
  801. <entry colname="4">
  802. <para>
  803. <literal>A</literal>
  804. </para>
  805. </entry>
  806. <entry colname="5">
  807. <para>
  808. <literal>10.0.0.3</literal>
  809. </para>
  810. </entry>
  811. </row>
  812. </tbody>
  813. </tgroup>
  814. </informaltable>
  815. <para>
  816. When a resolver queries for these records, <acronym>BIND</acronym> will rotate
  817. them and respond to the query with the records in a different
  818. order. In the example above, clients will randomly receive
  819. records in the order 1, 2, 3; 2, 3, 1; and 3, 1, 2. Most clients
  820. will use the first record returned and discard the rest.
  821. </para>
  822. <para>
  823. For more detail on ordering responses, check the
  824. <command>rrset-order</command> sub-statement in the
  825. <command>options</command> statement, see
  826. <xref endterm="rrset_ordering_title" linkend="rrset_ordering"/>.
  827. </para>
  828. </sect1>
  829. <sect1>
  830. <title>Name Server Operations</title>
  831. <sect2>
  832. <title>Tools for Use With the Name Server Daemon</title>
  833. <para>
  834. This section describes several indispensable diagnostic,
  835. administrative and monitoring tools available to the system
  836. administrator for controlling and debugging the name server
  837. daemon.
  838. </para>
  839. <sect3 id="diagnostic_tools">
  840. <title>Diagnostic Tools</title>
  841. <para>
  842. The <command>dig</command>, <command>host</command>, and
  843. <command>nslookup</command> programs are all command
  844. line tools
  845. for manually querying name servers. They differ in style and
  846. output format.
  847. </para>
  848. <variablelist>
  849. <varlistentry>
  850. <term id="dig"><command>dig</command></term>
  851. <listitem>
  852. <para>
  853. The domain information groper (<command>dig</command>)
  854. is the most versatile and complete of these lookup tools.
  855. It has two modes: simple interactive
  856. mode for a single query, and batch mode which executes a
  857. query for
  858. each in a list of several query lines. All query options are
  859. accessible
  860. from the command line.
  861. </para>
  862. <cmdsynopsis label="Usage">
  863. <command>dig</command>
  864. <arg>@<replaceable>server</replaceable></arg>
  865. <arg choice="plain"><replaceable>domain</replaceable></arg>
  866. <arg><replaceable>query-type</replaceable></arg>
  867. <arg><replaceable>query-class</replaceable></arg>
  868. <arg>+<replaceable>query-option</replaceable></arg>
  869. <arg>-<replaceable>dig-option</replaceable></arg>
  870. <arg>%<replaceable>comment</replaceable></arg>
  871. </cmdsynopsis>
  872. <para>
  873. The usual simple use of <command>dig</command> will take the form
  874. </para>
  875. <simpara>
  876. <command>dig @server domain query-type query-class</command>
  877. </simpara>
  878. <para>
  879. For more information and a list of available commands and
  880. options, see the <command>dig</command> man
  881. page.
  882. </para>
  883. </listitem>
  884. </varlistentry>
  885. <varlistentry>
  886. <term><command>host</command></term>
  887. <listitem>
  888. <para>
  889. The <command>host</command> utility emphasizes
  890. simplicity
  891. and ease of use. By default, it converts
  892. between host names and Internet addresses, but its
  893. functionality
  894. can be extended with the use of options.
  895. </para>
  896. <cmdsynopsis label="Usage">
  897. <command>host</command>
  898. <arg>-aCdlnrsTwv</arg>
  899. <arg>-c <replaceable>class</replaceable></arg>
  900. <arg>-N <replaceable>ndots</replaceable></arg>
  901. <arg>-t <replaceable>type</replaceable></arg>
  902. <arg>-W <replaceable>timeout</replaceable></arg>
  903. <arg>-R <replaceable>retries</replaceable></arg>
  904. <arg>-m <replaceable>flag</replaceable></arg>
  905. <arg>-4</arg>
  906. <arg>-6</arg>
  907. <arg choice="plain"><replaceable>hostname</replaceable></arg>
  908. <arg><replaceable>server</replaceable></arg>
  909. </cmdsynopsis>
  910. <para>
  911. For more information and a list of available commands and
  912. options, see the <command>host</command> man
  913. page.
  914. </para>
  915. </listitem>
  916. </varlistentry>
  917. <varlistentry>
  918. <term><command>nslookup</command></term>
  919. <listitem>
  920. <para><command>nslookup</command>
  921. has two modes: interactive and
  922. non-interactive. Interactive mode allows the user to
  923. query name servers for information about various
  924. hosts and domains or to print a list of hosts in a
  925. domain. Non-interactive mode is used to print just
  926. the name and requested information for a host or
  927. domain.
  928. </para>
  929. <cmdsynopsis label="Usage">
  930. <command>nslookup</command>
  931. <arg rep="repeat">-option</arg>
  932. <group>
  933. <arg><replaceable>host-to-find</replaceable></arg>
  934. <arg>- <arg>server</arg></arg>
  935. </group>
  936. </cmdsynopsis>
  937. <para>
  938. Interactive mode is entered when no arguments are given (the
  939. default name server will be used) or when the first argument
  940. is a
  941. hyphen (`-') and the second argument is the host name or
  942. Internet address
  943. of a name server.
  944. </para>
  945. <para>
  946. Non-interactive mode is used when the name or Internet
  947. address
  948. of the host to be looked up is given as the first argument.
  949. The
  950. optional second argument specifies the host name or address
  951. of a name server.
  952. </para>
  953. <para>
  954. Due to its arcane user interface and frequently inconsistent
  955. behavior, we do not recommend the use of <command>nslookup</command>.
  956. Use <command>dig</command> instead.
  957. </para>
  958. </listitem>
  959. </varlistentry>
  960. </variablelist>
  961. </sect3>
  962. <sect3 id="admin_tools">
  963. <title>Administrative Tools</title>
  964. <para>
  965. Administrative tools play an integral part in the management
  966. of a server.
  967. </para>
  968. <variablelist>
  969. <varlistentry id="named-checkconf" xreflabel="Named Configuration Checking application">
  970. <term><command>named-checkconf</command></term>
  971. <listitem>
  972. <para>
  973. The <command>named-checkconf</command> program
  974. checks the syntax of a <filename>named.conf</filename> file.
  975. </para>
  976. <cmdsynopsis label="Usage">
  977. <command>named-checkconf</command>
  978. <arg>-jvz</arg>
  979. <arg>-t <replaceable>directory</replaceable></arg>
  980. <arg><replaceable>filename</replaceable></arg>
  981. </cmdsynopsis>
  982. </listitem>
  983. </varlistentry>
  984. <varlistentry id="named-checkzone" xreflabel="Zone Checking application">
  985. <term><command>named-checkzone</command></term>
  986. <listitem>
  987. <para>
  988. The <command>named-checkzone</command> program
  989. checks a master file for
  990. syntax and consistency.
  991. </para>
  992. <cmdsynopsis label="Usage">
  993. <command>named-checkzone</command>
  994. <arg>-djqvD</arg>
  995. <arg>-c <replaceable>class</replaceable></arg>
  996. <arg>-o <replaceable>output</replaceable></arg>
  997. <arg>-t <replaceable>directory</replaceable></arg>
  998. <arg>-w <replaceable>directory</replaceable></arg>
  999. <arg>-k <replaceable>(ignore|warn|fail)</replaceable></arg>
  1000. <arg>-n <replaceable>(ignore|warn|fail)</replaceable></arg>
  1001. <arg>-W <replaceable>(ignore|warn)</replaceable></arg>
  1002. <arg choice="plain"><replaceable>zone</replaceable></arg>
  1003. <arg><replaceable>filename</replaceable></arg>
  1004. </cmdsynopsis>
  1005. </listitem>
  1006. </varlistentry>
  1007. <varlistentry id="named-compilezone" xreflabel="Zone Compilation application">
  1008. <term><command>named-compilezone</command></term>
  1009. <listitem>
  1010. <para>
  1011. Similar to <command>named-checkzone,</command> but
  1012. it always dumps the zone content to a specified file
  1013. (typically in a different format).
  1014. </para>
  1015. </listitem>
  1016. </varlistentry>
  1017. <varlistentry id="rndc" xreflabel="Remote Name Daemon Control application">
  1018. <term><command>rndc</command></term>
  1019. <listitem>
  1020. <para>
  1021. The remote name daemon control
  1022. (<command>rndc</command>) program allows the
  1023. system
  1024. administrator to control the operation of a name server.
  1025. Since <acronym>BIND</acronym> 9.2, <command>rndc</command>
  1026. supports all the commands of the BIND 8 <command>ndc</command>
  1027. utility except <command>ndc start</command> and
  1028. <command>ndc restart</command>, which were also
  1029. not supported in <command>ndc</command>'s
  1030. channel mode.
  1031. If you run <command>rndc</command> without any
  1032. options
  1033. it will display a usage message as follows:
  1034. </para>
  1035. <cmdsynopsis label="Usage">
  1036. <command>rndc</command>
  1037. <arg>-c <replaceable>config</replaceable></arg>
  1038. <arg>-s <replaceable>server</replaceable></arg>
  1039. <arg>-p <replaceable>port</replaceable></arg>
  1040. <arg>-y <replaceable>key</replaceable></arg>
  1041. <arg choice="plain"><replaceable>command</replaceable></arg>
  1042. <arg rep="repeat"><replaceable>command</replaceable></arg>
  1043. </cmdsynopsis>
  1044. <para>The <command>command</command>
  1045. is one of the following:
  1046. </para>
  1047. <variablelist>
  1048. <varlistentry>
  1049. <term><userinput>reload</userinput></term>
  1050. <listitem>
  1051. <para>
  1052. Reload configuration file and zones.
  1053. </para>
  1054. </listitem>
  1055. </varlistentry>
  1056. <varlistentry>
  1057. <term><userinput>reload <replaceable>zone</replaceable>
  1058. <optional><replaceable>class</replaceable>
  1059. <optional><replaceable>view</replaceable></optional></optional></userinput></term>
  1060. <listitem>
  1061. <para>
  1062. Reload the given zone.
  1063. </para>
  1064. </listitem>
  1065. </varlistentry>
  1066. <varlistentry>
  1067. <term><userinput>refresh <replaceable>zone</replaceable>
  1068. <optional><replaceable>class</replaceable>
  1069. <optional><replaceable>view</replaceable></optional></optional></userinput></term>
  1070. <listitem>
  1071. <para>
  1072. Schedule zone maintenance for the given zone.
  1073. </para>
  1074. </listitem>
  1075. </varlistentry>
  1076. <varlistentry>
  1077. <term><userinput>retransfer <replaceable>zone</replaceable>
  1078. <optional><replaceable>class</replaceable>
  1079. <optional><replaceable>view</replaceable></optional></optional></userinput></term>
  1080. <listitem>
  1081. <para>
  1082. Retransfer the given zone from the master.
  1083. </para>
  1084. </listitem>
  1085. </varlistentry>
  1086. <varlistentry>
  1087. <term><userinput>sign <replaceable>zone</replaceable>
  1088. <optional><replaceable>class</replaceable>
  1089. <optional><replaceable>view</replaceable></optional></optional></userinput></term>
  1090. <listitem>
  1091. <para>
  1092. Fetch all DNSSEC keys for the given zone
  1093. from the key directory (see
  1094. <command>key-directory</command> in
  1095. <xref linkend="options"/>). If they are within
  1096. their publication period, merge them into the
  1097. zone's DNSKEY RRset. If the DNSKEY RRset
  1098. is changed, then the zone is automatically
  1099. re-signed with the new key set.
  1100. </para>
  1101. <para>
  1102. This command requires that the
  1103. <command>auto-dnssec</command> zone option be set
  1104. to <literal>allow</literal> or
  1105. <literal>maintain</literal>,
  1106. and also requires the zone to be configured to
  1107. allow dynamic DNS.
  1108. See <xref linkend="dynamic_update_policies"/> for
  1109. more details.
  1110. </para>
  1111. </listitem>
  1112. </varlistentry>
  1113. <varlistentry>
  1114. <term><userinput>loadkeys <replaceable>zone</replaceable>
  1115. <optional><replaceable>class</replaceable>
  1116. <optional><replaceable>view</replaceable></optional></optional></userinput></term>
  1117. <listitem>
  1118. <para>
  1119. Fetch all DNSSEC keys for the given zone
  1120. from the key directory (see
  1121. <command>key-directory</command> in
  1122. <xref linkend="options"/>). If they are within
  1123. their publication period, merge them into the
  1124. zone's DNSKEY RRset. Unlike <command>rndc
  1125. sign</command>, however, the zone is not
  1126. immediately re-signed by the new keys, but is
  1127. allowed to incrementally re-sign over time.
  1128. </para>
  1129. <para>
  1130. This command requires that the
  1131. <command>auto-dnssec</command> zone option
  1132. be set to <literal>maintain</literal>,
  1133. and also requires the zone to be configured to
  1134. allow dynamic DNS.
  1135. See <xref linkend="dynamic_update_policies"/> for
  1136. more details.
  1137. </para>
  1138. </listitem>
  1139. </varlistentry>
  1140. <varlistentry>
  1141. <term><userinput>freeze
  1142. <optional><replaceable>zone</replaceable>
  1143. <optional><replaceable>class</replaceable>
  1144. <optional><replaceable>view</replaceable></optional></optional></optional></userinput></term>
  1145. <listitem>
  1146. <para>
  1147. Suspend updates to a dynamic zone. If no zone is
  1148. specified,
  1149. then all zones are suspended. This allows manual
  1150. edits to be made to a zone normally updated by dynamic
  1151. update. It
  1152. also causes changes in the journal file to be synced
  1153. into the master
  1154. and the journal file to be removed. All dynamic
  1155. update attempts will
  1156. be refused while the zone is frozen.
  1157. </para>
  1158. </listitem>
  1159. </varlistentry>
  1160. <varlistentry>
  1161. <term><userinput>thaw
  1162. <optional><replaceable>zone</replaceable>
  1163. <optional><replaceable>class</replaceable>
  1164. <optional><replaceable>view</replaceable></optional></optional></optional></userinput></term>
  1165. <listitem>
  1166. <para>
  1167. Enable updates to a frozen dynamic zone. If no zone
  1168. is
  1169. specified, then all frozen zones are enabled. This
  1170. causes
  1171. the server…