内に含まその他のドキュメントサポート リソース | PDF 文書ファイルをダウンロードする (1529 KB)
Part II DNS Setup and AdministrationThis part describes the setup, configuration, administration and troubleshooting of DNS naming service in the Solaris operating environment. Chapter 3 Domain Name System (Overview)This chapter provides an overview of the Domain Name System (DNS). Note – One of the most common and important uses of DNS is connecting your network to the global Internet. To connect to the Internet, your network IP address must be registered with whomever is administering your parent domain. This chapter covers the following topics. DNS BasicsThe Domain Name System (DNS) is an application–layer protocol that is part of the standard TCP/IP protocol suite. This protocol implements the DNS naming service, which is the naming service that is used on the Internet. This section introduces the basic DNS concepts. You should have some familiarity with network administration, particularly TCP/IP, and some exposure to other naming services, such as NIS+ and NIS. Refer to Chapter 4, Administering DNS (Tasks) for information regarding initial setup and configuration of DNS. Note – DNS, NIS+, NIS, and FNS provide similar functionality and sometimes use the same terms to define different entities. In this chapter, terms like domain and name server are defined by their DNS functionality. Name-to-Address ResolutionThough DNS supports the complex, worldwide hierarchy of computers on the Internet, the basic function of DNS is actually very simple. DNS provides name-to-address resolution for TCP/IP-based networks. Name-to-address resolution, also referred to as mapping, is the process of finding the IP address of a computer in a database by using its host name as an index. Name-to-address mapping occurs when a program running on your local machine needs to contact a remote computer. The program might know the host name of the remote computer. However, the program might not now how to locate the machine, particularly if the machine is in another company domain, for example. To get the remote machine's address, the program requests assistance from the DNS software running on your local machine, which is considered a DNS client. Your machine sends a request to a DNS name server, which maintains the distributed DNS database. DNS files bear little resemblance to files that contain similar information. For example, the NIS+ host, the ipnodes Table, the local /etc/hosts and the /etc/inet/ipnodes file contain the host names, the ipnode names, IPv4 and IPv6 addresses, and other information about a particular group of computers. The name server uses the your machine's host name as part of your request to find or “resolve” the IP address of the remote machine. The name server returns this IP address to your local machine if the host name is in its DNS database. The following figure shows name-to-address mapping between a DNS client and a name server, probably on the client's local network. Figure 3–1 Name to Address Resolution
If the host name is not in that name server's DNS database, the machine is outside of its authority, or, to use DNS terminology, outside the local administrative domain. Thus, each name server is spoken of as being “authoritative” for its local administrative domain. Fortunately, the local name server maintains a list of host names and IP addresses of root domain name servers, to which the server forward requests. These root name servers are authoritative for huge organizational domains, as explained fully in DNS Hierarchy and the Internet. These hierarchies resemble UNIX file systems, in that the servers are organized into an upside down tree structure. Each root name server maintains the host names and IP addresses of top level domain name servers for a given organization. The root name server sends your request to the known top-level name servers. If one server has the IP address for the host you requested, the server returns the information to your machine. If the top-level servers do not recognized the requested host, the request is passed to second-level name servers. Your request is then passed on down through the vast organizational tree. Eventually, a name server that has information about your requested host in its database returns the IP address back to your machine. The following figure shows name-to-address resolution outside the local domain. Figure 3–2 Name to Address Resolution for a Remote Host
DNS Administrative DomainsFrom a DNS perspective, an administrative domain is a group of machines which are administered as a unit. Information about this domain is maintained by at least two name servers, which are “authoritative” for the domain. The DNS domain is a logical grouping of machines. The domain groupings could correspond to a physical grouping of machines, such as all machines attached to the Ethernet in a small business. Similarly, a local DNS domain could include all machines on a vast university network that belong to the computer science department or to university administration. For example, suppose the Ajax company has two sites, in San Francisco and in Seattle. The Retail.Sales.Ajax.com. domain is in Seattle. The Wholesale.Sales.Ajax.com. domain is in San Francisco. One part of the Sales.Ajax.com. domain would be in one city, the other part in the second city. Each administrative domain must have its own unique subdomain name. Moreover, if you want your network to participate in the Internet, the network must be part of a registered administrative domain. The section Joining the Internet has full details about domain names and domain registration. in.named and DNS Name ServersAs mentioned previously, name servers in an administrative domain maintain the DNS database. Name servers also run the in.named daemon, which implements DNS services. in.named is a public domain TCP/IP program and is included with the Solaris operating environment. Note – in.named is also called the Berkeley Internet Name Domain service, or BIND, because the daemon was developed at the University of California at Berkeley. There are three types of DNS name servers. Each domain must have one master server and at least one slave server to provide backup. Implementing DNS: A Practical Example explains primary and secondary servers in detail. Server Configuration and Data File NamesTo function correctly, the in.named daemon requires a configuration file and four data files. Configuration FileThe master server configuration file is /etc/named.conf. The file contains a list of domain names and the file names that contain host information. See The named.conf File for additional information on the named.conf file. Names of DNS Data FilesIf you are internally consistent, the zone data files can be named anything. This flexibility might lead to some confusion when working at different sites or referring to different DNS manuals and books. For example, the file names that are used in Sun manuals differ from those used in the book DNS and BIND published by O'Reilly & Associates and both of those nomenclatures have some differences from that used in the public-domain Name Server Operations Guide for BIND. In addition, this documentation uses generic names that identify a file's main purpose, and specific example names in code samples. For example, this documentation uses the generic name hosts when describing the function and role of a file. Example names db.doc and db.sales are used in code samples. The required data files are the following.
$INCLUDE FilesAn include file is any file which is named in an $INCLUDE() statement in a DNS data file. $INCLUDE files can be used to separate different types of data into multiple files for your convenience. See The $INCLUDE File. For reference purposes, the following table compares BIND file names from the above mentioned sources. Table 3–1 File Name Examples
Domain NamesA domain name is the name that is assigned to a group of systems on a local network that share DNS administrative files. A domain name is required for the network information service database to work properly. Default Domain NameDNS obtains your default domain name from your resolv.conf file.
Trailing Dots in Domain NamesWhen working with DNS-related files, follow these rules that pertain to the trailing dot in domain names:
DNS Clients and the ResolverTo be a DNS client, a machine must run the resolver. The resolver is neither a daemon nor a single program. The resolver is a set of dynamic library routines used by applications that need to know machine names. The resolver's function is to resolve users' queries. The resolver queries a name server, which then returns either the requested information or a referral to another server. Once the resolver is configured, a machine can request DNS service from a name server. The DNS name server uses several files to load its database. At the resolver level, the server needs the file /etc/resolv.conf listing the addresses of the servers that store the requested information. The resolver reads this resolv.conf file to find the name of the local domain and the location of name servers. This resolv.conf file sets the local domain name. The file also instructs the resolver routines to query the listed name servers for information. Normally, each DNS client system on your network has a resolv.conf file in its /etc directory. If a client does not have a resolv.conf file, the client uses a default server at IP address 127.0.0.1. Whenever the resolver has to find the IP address of a host, or the host name corresponding to an address, the resolver builds a query package and sends it to the name servers listed in /etc/resolv.conf. The servers either answer the query locally or contact other known servers, ultimately returning the answer to the resolver. When a machine's /etc/nsswitch.conf file specifies hosts: dns or any other variant that includes dns in the hosts line, the resolver libraries are automatically used. If the nsswitch.conf file specifies another naming service before dns, that naming service is consulted first. If that naming service does not find the host in question, the resolver libraries are then used. For example, if the hosts line in the nsswitch.conf file specifies hosts: nisplus dns, the NIS+ naming service will first be searched for host information. If the information is not found in NIS+, then the DNS resolver is used. A hosts:nisplus dns line in a switch file indicates the use of NIS+ for local host information and DNS for remote information. There are two kinds of DNS clients.
The resolv.conf FileFor a detailed description of what the resolv.conf file does, see the resolv.conf(4) man page. See Setting Up the resolv.conf File for a discussion on how to set up the resolv.conf file. The named.conf FileBIND 8.1 added a new configuration file, /etc/named.conf. named.conf replaces the /etc/named.boot file. The /etc/named.conf file establishes the server as a master, slave, or cache-only name server. named.conf also specifies the zones over which the server has authority and which data files it should read to get its initial data. The /etc/named.conf file contains statements that implement:
The configuration file is read by in.named when the daemon is started by the server's startup script, /etc/init.d/inetsvc. The configuration file directs in.named to other servers or to local data files for a specified domain. The named.conf file contains statements and comments. Statements end with a semicolon. Some statements can contain a block of statements. Again, each statement in the block is terminated with a semicolon. Table 3–2 named.conf Statements
Example 3–1 Example Master Configuration File for a Master Server
DNS Hierarchy in a Local DomainIf your company is large enough, your company might support several domains, organized into a local namespace. The following figure shows a domain hierarchy that might be in place in a single company. The top-level, or “root” domain for the organization is ajax.com, which has three subdomains: sales.ajax.com, test.ajax.com, and manf.ajax.com. Figure 3–3 Hierarchy of DNS Domains in a Single Organization
DNS clients request service only from the servers that support their domain. If the domain's server does not have the needed information, the server forwards the client request to its parent server. The parent server is in the next higher domain in the hierarchy. If the request reaches the top-level server, the top-level server determines whether the domain is valid. If the domain is not valid, the server returns a “not found” type message to the client. If the domain is valid, the server routes the request down to the server that supports that domain. DNS Hierarchy and the InternetThe domain hierarchy that is shown in the following figure is a “leaf” of the huge DNS namespace supported on the global Internet. The figure consists of the root directory, which is represented as a dot (.), and two top level domain hierarchies, one organizational and one geographical. Note that the com domain introduced in this figure is one of a number of top-level organizational domains in existence on the Internet. Figure 3–4 Hierarchy of Internet Domains
At the present time, the organizational hierarchy divides its namespace into the top-level domains listed shown in the following table. Additional top-level organizational domains can be added in the future. Table 3–3 Internet Organizational Domains
The geographic hierarchy assigns each country in the world a two or three-letter identifier. The hierarchy also provides official names for the geographic regions within each country. For example, domains in Britain are subdomains of the uk top-level domain, Japanese domains are subdomains of jp, and so on. Joining the InternetThe Internet root domain, top-level domains, organizational and geographical, are maintained by the various Internet governing bodies. People with networks of any size can “join” the Internet by registering their domain name in either the organizational or the geographical hierarchy. Every DNS domain must have a domain name. If you use DNS for naming service without connecting to the Internet, you can use any name for the domains and subdomains. However, if your site plans wants to join the Internet, your company must register its domain name with the Internet governing bodies. To join the Internet, do the following.
Domain Names in the DNS NamespaceDomain names indicate a domain's position in the overall DNS namespace, much as path names indicate a file's position in the UNIX file system. After your local domain is registered, its name is added to the name of the Internet hierarchy to which the domain belongs. For example, the ajax domain that is shown in Figure 3–5 has been registered as part of the Internet com hierarchy. Therefore, its Internet domain name becomes ajax.com. The following figure shows the position of the ajax.com domain in the DNS namespace on the Internet. Figure 3–5 Ajax Domain's Position in the DNS Namespace
The ajax.com subdomains now have the following names.
DNS domain names can be capitalized or in lower case. Here are some examples of machines and domain names.
The Internet organization grants each domain authority over the names of its hosts. The organization expects each domain to delegate authority to the levels below. Thus, the com domain has authority over the names of the hosts in its domain. The organization also authorizes the formation of the ajax.com domain and delegates authority over the names in that domain. The ajax.com domain then assigns names to the hosts in its domain. The ajax.com domain also approves the formation of the sales.ajax.com, test.ajax.com, and manf.ajax.com domains. Fully Qualified Domain Names (FQDNs)A domain name is said to be fully-qualified when the name includes the names of every DNS domain from the local domain on up to “.”, the DNS root domain. Conceptually, the fully qualified domain name indicates the path to the root, as does the absolute path name of a UNIX file. However, fully qualified domain names are read from lowest, on the left, to highest, on the right. Therefore, a fully-qualified domain name has the following syntax. ![]() The fully qualified domain names for the ajax domain and its subdomains are:
Note the dot at the furthest right position of each name. Zones and DNSDNS service for a domain is managed on the set of name servers. Name servers can manage a single domain, multiple domains, or domains with their corresponding subdomains. The part of the namespace controlled by a name server is called a zone. Therefore, the name server is said to be authoritative for the zone. If you are responsible for a particular name server, you might be given the title “Zone Administrator”. The data in a name server's database are called zone files. One type of zone file stores IP addresses and host names. When someone attempts to connect to a remote host using a host name by a utility like ftp or telnet, DNS performs name-to-address mapping. DNS looks up the host name in the zone file and converting the name into its IP address. Figure 3–6 Domains and Zones
For example, the Ajax domain in the above example contains a top domain (Ajax), four subdomains, and five sub-subdomains. The domain is divided into four zones. Thus, the Ajax name server administers a zone which is composed of the Ajax, Sales, Retail, and Wholesale domains. The Manf and QA domains are zones unto themselves served by their own name servers. The Corp name server manages a zone composed of the Corp, Actg, Finance, and Mktg domains. Reverse MappingThe DNS database also includes zone files that use the IP address to find machine host names, enabling IP address to host name resolution. This process is called reverse resolution or more commonly, reverse mapping. Reverse mapping is used primarily to verify the identity of the machine that sent a message or to authorize remote operations on a local host. The in-addr.arpa DomainThe in-addr.arpa domain is a conceptual part of the DNS namespace that uses IP addresses for its leaves, rather than domain names. The domain is the part of your zone that enables address-to-name mapping. in-addr.arpa domain IP addresses are read from lowest level to the root. Thus, the IP addresses are read backward. For example, suppose a host has the IP address 192.168.21.165. In the in-addr.arpa zone files, its address is listed as 165.21.168.192.in-addr.arpa. with the dot at the end indicating the root of the in-addr.arpa domain. Chapter 4 Administering DNS (Tasks)This chapter describes how to administer the Domain Name System (DNS). The chapter covers the following topics. Setting Up the resolv.conf FileA simple example resolv.conf file for a server in the doc.com domain is shown below. Example 4–1 Sample resolv.conf File for DNS Server
The first line of the /etc/resolv.conf file lists the domain name in the form:
Where domainname is the name that is registered with InterNIC. Note – No spaces or tabs are permitted at the end of the domain name. Make sure that you press return immediately after the last character of the domain name. The second line identifies the server in the form:
The next lines list the IP addresses of one or more slave or cache-only name servers that the resolver should consult to resolve queries. Name server entries have the form:
IP_address is the IP address of a slave or cache-only DNS name server. The resolver queries these name servers in the order the servers are listed until the resolver obtains the information it needs. With BIND 8.3.3, the DNS client can connect to IPv6 DNS servers using an IPv6 transport. To enable such a connection, enter an IPv6 address after nameserver in the resolv.conf file. An example /etc/resolv.conf file with IPv6 name servers would look like the following.
There can be any combination of IPv4 and IPv6 addresses for name servers in the resolv.conf file. Configuring a Network For DNSTo configure a network for DNS, you must set up a client and a server. How to Set Up a DNS ClientSet up the clients prior to setting up the DNS server.
How to Set Up a DNS Server
How to Specify a Master ServerThe two types of master server are as follows.
To specify a server as the master server for a given zone, you create three master records in that server's named.boot file.
How to Specify a Slave ServerA slave server maintains a copy of the data for the zone. The master server sends its data and delegates authority to the slave server. Clients can query a slave server for DNS information. By using slave servers, you can improve response time by spreading the load over multiple machines. Slave servers also provide backup when the master server crashes. When in.named starts, the daemon requests all the data for the given zone from the master. The slave server then periodically checks with the master to see if the master needs to update its database. The process of sending the most recent zone database from the master to the slave is called a zone transfer. Therefore, you do not modify data files on a slave server. You modify the data files on the zone's master server. The slave servers then update their files from the master. To specify that a server is to be the slave server for a given zone, you create slave records in that server's named.boot file. Separate records can designate the server as a slave server for the zone, the zone's reverse address domain, and the loopback host. A slave record has three required fields:
A “slave” record can have one or more optional fields after the required fields. The optional fields are the following:
For example, the following lines in a boot file specify that the server is the slave server for the doc.com zone and its reverse address domain. The lines also specify that the slave server obtains its authoritative data from the master server at 172.16.0.1, that the slave server uses the server 172.16.0.2 as a slave source of zone data, and initially loads its data from the file doc.com.backup:
The sample boot file lines above correspond to the boot file of the dnsslave server, which is an alias for the sirius machine whose IP address is 192.146.168.38. Note – A server can act as the master server for one or more zones, and as the slave server for one or more zones. The mixture of entries in the boot file determines whether a server is a master or slave server for a given zone. How to Specify a Cache-Only or Stub ServerAll servers are caching servers as all servers maintain a cache of DNS data. A caching only or stub server is a server that is not a master server for any zone other than the in-addr.arpa. domain. A cache-only server does not maintain any authoritative data. The cache-only server handles queries by asking the hosts that are listed in the in.named file for the needed information. In other words, a cache-only server handles queries but does not maintain any authoritative data. The following is a sample boot file for a cache only server. Example 4–3 Sample Master Boot File for Caching-only Server
You do not need a special line to designate a server as a cache-only server. What denotes a cache-only server is the absence of any slave or master authority lines in the boot file, except as noted below. A cache-only server requires the following.
DNS Compatibility and +/- SyntaxThis section describes how to use the +/- syntax when you use either NIS or NIS+ as your master naming service. How to Add DNS Compatibility and +/- Syntax
Setting Up DNS ServersHow to Initialize the ServerTo initialize a server, do the following.
How to Test Your InstallationAfter your boot and data files are set up and in.named running, test your installation.
How to Add Additional ServersYou can add primary and secondary DNS servers to your network.
Modifying DNS Data FilesWhenever you modify one of the DNS data files in the master DNS server, you must also do the following.
How to Change the SOA Serial NumberEvery DNS database file begins with a Start of Authority (SOA) resource record. Whenever you alter any data in a DNS database file, you must increment the SOA serial number by one integer. For example, if the current SOA Serial Number in a data file is 101, and you make a change to the file's data, you must change 101 to 102. If you don't change the SOA serial number, the domain's slave servers do not update their copy of the database files with the new information. The master and slave servers would then be out of sync. A typical SOA record of a sample hosts file looks like the following.
Therefore, if you made a change to this hosts file, you would change 109 to 110. The next time that you change the file, you would change 110 to 111. How to Force in.named to Reload DNS DataWhen in.named successfully starts, the daemon writes its process ID to the file /etc/named.pid. To have in.named reread named.conf and reload the database do the following. The above procedure eliminates all of the existing cache. The caching process then restarts. Do not attempt to run in.named from inetd. Doing so continuously restarts the name server, which defeats the purpose of having a cache. Adding and Deleting ClientsWhen you add or delete a client, always make your changes in the data files stored on your master DNS server. Do not edit the files on your slave servers. The files are automatically updated from the master server when you change the SOA serial number. How to Add a ClientTo add a client to a DNS domain, set the new machine up as a DNS client. Then, add records for the new machine to the appropriate hosts and hosts.rev files. For example, to add the host rigel to the doc.com domain, do the following.
How to Remove a ClientTo remove a client from a DNS domain do the following.
Enabling a Client to Use IPv6You can enable a client to use IPv6 by using the following procedure. How to Enable a Client to Use IPv6
Creating DNS SubdomainsAs your network grows, you might want to divide the network into DNS subdomains. See The DNS Namespace Hierarchy for a discussion of DNS domain hierarchy and structure. When you divide your network into a parent domain and subdomains, you reduce the load on individual DNS servers by distributing responsibility across multiple domains. Network performance then improves. By dividing your network into geographic or organizational subdomains, the DNS domain names indicate where a given machine or email address fits into your structure. For example, rigel@alameda.doc.com implies that the machine rigel is located at your Alameda site. The email address barnum@sales.doc.com implies that the user barnum is part of your Sales organization. The division of a network into multiple domains requires more set up work. And, you have to maintain the delegation data that ties your domains together. On the other hand, when you have multiple domains, you can distribute domain maintenance tasks among different domain administrators. Planning Your SubdomainsThe following points are to be considered before dividing your network into a parent and subdomains.
How to Set Up a SubdomainIn most cases, new subdomains are usually created from the start with a new network and new machines, or split off from an existing domain. The process is essentially similar in both cases. Once you have planned your new subdomain, do the following.
Solaris DNS BIND 8.3.3 ImplementationFor your convenience, the Solaris operating environment supplies a compiled version of Berkeley Internet Name Domain (BIND) version 8.3.3. The version of BIND includes security fixes that are part of BIND version 8.3.4. In compiling this software, options and choices were made to meet the needs of the greatest number of sites. If the pre-compiled version of BIND does not meet your requirements, you can recompile your own version of BIND from the publicly available source code. In compiling the BIND version supplied with the Solaris operating environment, the following choices were made.
How to Migrate from BIND 4.9.x to BIND 8.3.3As of the Solaris 9 release, the named.boot file is ignored.
DNS ForwardingThe nsswitch.conf file controls DNS forwarding and Interent access for clients. NIS clients have implicit forwarding capabilities. NIS+ clients do not. See below. How to Enable DNS Forwarding Capabilities on an NIS+ Client
In this implementation of NIS, if a /etc/resolv.conf file exists on the server, ypstart automatically starts the ypserv daemon with the -d option to forward requests to DNS. To stop forwarding to DNS, edit the /usr/lib/netsvc/yp/ypstart script to remove the -d option from the ypserv command. You must then reboot the machine. How to Enable DNS Forwarding Capabilities on an Older NIS Client
The Solaris operating environment includes the dynamic library routines that make up the resolver. Chapter 5 DNS Administration (Reference)This chapter covers the following topics. Implementing DNS: A Practical ExampleThis section shows the files you need to implement DNS for a sample Internet-connected network, based on the examples used in this chapter. The IP addresses and network numbers used in examples and code samples in this manual are for illustration purposes only. Do not use them as shown because they might have been assigned to an actual network or host. This example assumes the following.
Example Boot FilesThe following code examples show boot files for the three servers in the two networks. Example 5–1 Example Boot File for dnsmastr Server
Example 5–2 Example Boot File for dnssales Server
Example 5–3 Example Boot File for dnssecond Server
Example resolv.conf FilesThe following code examples show resolv.conf files for the three servers in the two networks. If the host in question is not running in.named, the local host address should not be used as a name server. Example 5–4 Example resolv.conf File for dnsmastr Server
Example 5–5 Example resolv.conf File for dnssales Server
Example 5–6 Example resolv.conf File for dnssecond Server
Example named.local FileThe following code example shows the named.local file used by the two master servers on the two networks. Both servers have the same file. Example 5–7 Example named.local File for Both Master Servers
Example hosts FilesThe following code examples show db.doc and db.sales files for the two master servers on the two networks. Example 5–8 Example db.doc File for dnsmastr Server
Example 5–9 Example db.sales File for dnssales Server
Example hosts.rev FilesThe following code examples show hosts.rev files for the two master servers on the two networks. Example 5–10 Example doc.rev File for dnsmastr server
Example 5–11 Example hosts.rev File for dnssales Server
Example name.ca FileThe following code example shows the named.ca file that is stored on each of the two master servers on the two networks. Both servers use identical named.ca files. Example 5–12 Example named.ca File
Setting Up the Data FilesAll the data files used by the DNS daemon in.named are written in standard resource record format. Each line of a file is a record, called a resource record (RR). Each DNS data file must contain certain resource records. The most commonly used types of resource records are listed in Table 5–6. They are usually entered in the order shown in Table 5–6, but that is not a requirement. In the sample files included in the following sections, @ indicates the current zone or origin and lines that begin with a semicolon (;) are comments. Setting Up SubdomainsYou can set up subdomains within the same zone or within different zones. Both methods are described in the following sections. Setting Up Subdomains: Same ZoneThe simplest method is to include the subdomain in the parent domain's zone. In this way, one set of DNS servers and data files applies to all the machines regardless of their domain. The advantage of the same-zone method is simplicity and ease of administration. The disadvantage is that one set of servers has to serve all machines in all of the zone's domains. If there are too many machines, the servers will be overloaded and network performance can decline. Data files for multidomain zones must include records for all machines and servers in each domain covered by the zone. Setting up a multidomain zone is the same as setting up a zone with a single domain, except that fully qualified domain names are used in the hosts file to identify machines in remote domains. In other words, in the hosts file, when you identify a machine in the server's local domain, you need to use only the machine's name. But when you identify a machine in some other domain, you must identify the machine with a fully qualified domain name in the format: machine.domain. Server and machine names in hosts.rev and named.local files also need to be fully qualified with domain names. But that is true regardless of whether or not the zone has more than one domain. Setting Up Subdomains: Different ZonesThe advantage of the different-zone method is that you can assign different sets of servers to serve machines in different domains; in that way, you spread out server load so that no group of servers is overloaded. The disadvantage is that setup maintenance is more complicated. Setting up subdomains that are in different zones is more complicated than including multiple domains in a single zone, because you have to specify how clients in different zones obtain DNS information from the other zones. To divide a network into multiple domains, create a domain hierarchy. That is, one domain becomes the top domain. Beneath the top domain, you create one or more subdomains. If you want, you can create subdomains of subdomains. But every subdomain has a set place relative to the top domain in the hierarchy of domains. When read from left to right, domain names identify the domain's place in the hierarchy. For example, the doc.com domain is above the sales.doc.com domain, while the west.sales.doc.com domain is below the sales.doc.com domain. DNS zones acquire a hierarchy from the domains that they contain. The zone containing a network's top domain is the top zone. A zone that contains one or more subdomains below the top domain is below the top zone in the zone hierarchy. When DNS information is passed from one zone to another, it is passed up and down the zone hierarchy. This means that each zone requires records in its data files that specify how to pass information up to the zone immediately above it, and down to any zones immediately below it. To correctly transfer DNS information from one zone to another in a multi-zone network:
The example files in the next chapter illustrate a network with two zones. The DNS Namespace HierarchyThe entire collection of DNS administrative domains throughout the world are organized in a hierarchy called the DNS namespace. This section shows how the namespace organization affects both local domains and the Internet. Domains and SubdomainsLike the UNIX file system, DNS domains are organized as a set of descending branches similar to the roots of a tree. Each branch is a domain, each subbranch is a subdomain. The terms domain and subdomain are relative. A given domain is a subdomain relative to those domains above it in the hierarchy, and a parent domain to the subdomains below it. Figure 5–1 Domains and Subdomains
For example, in Figure 5–1, com is a parent domain to the Acme, Ajax, and AAA domains. Or you could just as easily say that those are subdomains relative to the com domain. In its turn, the Ajax domain is a parent to four subdomains (Sales, Manf, QA, and Corp). A domain contains one parent (or top) domain plus the associated subdomains if any. Domains are named up the tree starting with the lowest (deepest) subdomain and ending with the root domain. How DNS Affects Mail DeliveryIn addition address mapping and maps addresses to host names, as discussed in Name-to-Address Resolution, DNS also helps mail delivery agents, such as sendmail and POP, deliver mail along the Internet. To deliver mail across the Internet, DNS uses mail exchange records (MX records). Most organizations do not allow direct delivery of mail that comes across the Internet for hosts within the organization. Instead, they use a central mail host (or a set of mail hosts) to intercept incoming mail messages and route them to their recipients. The mail exchange record identifies the mail host that services each machine in a domain. Therefore, a mail exchange record lists the DNS domain names of remote organizations and either the IP address or the host name of its corresponding mail host. DNS Configuration and Data FilesIn addition to the in.named daemon, DNS on a name server consists of a boot file called named.conf, a resolver file named resolv.conf, and four types of zone data files. Names of DNS Data FilesSo long as you are internally consistent, you can name the zone data files anything you want. This flexibility can lead to some confusion when working at different sites or referring to different DNS manuals and books. For example, the file names used in Sun manuals and at most many Solaris sites vary from those used in the book DNS and BIND by Albitz and Liu, O'Reilly & Associates, 1992, and both of those nomenclatures have some differences from that used in the public-domain Name Server Operations Guide for BIND, University of California. In addition, this manual and other DNS documentation uses generic names that identify a file's main purpose, and specific example names for that file in code record samples. For example, Solaris Naming manuals use the generic name hosts when describing the function and role of that file, and the example names db.doc and db.sales.doc in code samples. For reference purposes, the following table compares BIND file names from these three sources. Table 5–3 BIND File Name Examples
The IP addresses and network numbers used in examples and code samples in this manual are for illustration purposes only. Do not use them as shown because they might have been assigned to an actual network or host. The named.conf FileThe BIND configuration file, /etc/named.conf establishes the server as a master, slave, or cache-only name server. It also specifies the zones over which the server has authority and which data files it should read to get its initial data. The /etc/named.conf file contains statements that implement the following.
The configuration file is read by in.named when the daemon is started by the server's start up script, /etc/init.d/inetsvc. The configuration file directs in.named either to other servers or to local data files for a specified domain. named.conf StatementsThe named.conf file contains statements and comments. Statements end with a semicolon. Some statements can contain a contain a block of statements. Again, each statement in the block is terminated with a semicolon. The named.conf file supports the following statements. Table 5–4 named.conf Statements
Example 5–13 Example Master Configuration File for a master server
The named.ca FileThe named.ca file establishes the names of root servers and lists their addresses. If your network is connected to the Internet, named.ca lists the Internet name servers; otherwise, it lists the root domain name servers for your local network. The in.named daemon cycles through the list of servers until it contacts one of them. It then obtains from that server the current list of root servers, which it uses to update named.ca. Setting Up the named.ca FileRoot server names are indicated in the NS record and addresses in the A record. You need to add an NS record and an A record for each root server you want to include in the file. How you obtain or create your named.ca file depends on whether or not your network is connected to the world Internet. Internet named.ca FileIf your network is connected to the Internet, at the present time you obtain your named.ca file from InterNIC registration services through the following.
If you are following the naming conventions used in this manual, you then move named.root to /var/named/named.ca. Example 5–14 Example Internet named.ca file
Non-Internet named.ca FileIf your network is not connected to the Internet, you create your own named.ca file. To do this, you designate one of your servers to be the root server, then create a named.ca file on every DNS server pointing to that root server. For example, suppose your domain is named private and you designate the machine ourroot as your non-Internet root server. The ourroot machine has an IP address of 192.1.1.10. Your named.ca files would then contain the line:
Cache files also need an SOA record, NS records for each domain and subdomain, and A records for each server. For example, suppose that in addition to ourroot you also had DNS name servers called ourmaster and ourslave. The named.ca files on all of your DNS servers would then look like the following. Example 5–15 Sample named.ca File (Non-Internet)
The hosts FileThe hosts file contains all the data about the machines in the local zone. The name of this file is specified in the boot file. To avoid confusion with /etc/hosts, name the file something other than hosts, for example, you could name these files using the pattern db.domain. Using that nomenclature, the host files for the doc.com and sales.doc.com domains might be db.doc and db.sales. Setting Up the hosts FileThe hosts file contains all the data about every machine in your zone. If a zone covers more than one domain, all machines in all the domains covered by the zone are listed in the zone's host file. See Setting Up the hosts File. Note – The name hosts is a generic name indicating the file's purpose and content. But to avoid confusion with /etc/hosts, you should name this file something other than hosts. If you have more than one zone, each zone must have its own hosts file and each of these zone hosts files must have a unique name. For example, if your DNS domain is divided into doc.com and sales.doc.com zones, you could name one hosts file db.doc and the other sales.db.doc. There must be a separate, uniquely named, hosts file for each zone. If you have more than one zone, each zone's host file must include information about the master (master and slave) servers of the other zones, as described in Example 5–16. Example 5–16 Sample hosts File
A hosts file usually contains these elements:
The hosts.rev FileThe hosts.rev file specifies a zone in the in-addr.arpa. domain, the special domain that allows reverse (address-to-name) mapping. The name of this file is specified in the boot file. Setting Up the hosts.rev FileThe hosts.rev file sets up inverse mapping. Note – The name hosts.rev is a generic name indicating the file's purpose and content. If you have more than one zone, each zone must have its own hosts.rev file and each of these zone hosts.rev files must have a unique name. For example, if your DNS domain is divided into doc.com and sales.doc.com zones, you could name one hosts.rev file doc.rev and the other sales.rev. Example 5–17 Sample hosts.rev File
A hosts.rev file contains the following elements.
(See Resource Record Types for detailed descriptions of these resource record types.) The named.local FileThe named.local file specifies the address for the local loopback interface, or localhost, with the network address 127.0.0.1. The name of this file is specified in the boot file. Like other files, you can give it a name other than the name used in this manual. Setting Up the named.local FileThe named.local file sets up the local loopback interface for your name server. Example 5–18 Sample named.localFile
A named.local file contains these elements:
The $INCLUDE FileAn include file is any file named in an $INCLUDE() statement in a DNS data file. $INCLUDE files can be used to separate different types of data into multiple files for your convenience. For example, suppose a data file contained following line:
This line causes the /etc/named/data/mailboxes file to be loaded at that point. In this instance, /etc/named/data/mailboxes is an $INCLUDE file. Use of $INCLUDE files is optional. You can use as many as you wish, or none at all. Data File Resource Record FormatAll the data files used by the DNS daemon in.named are written in standard resource record format. Each DNS data file must contain certain resource records. This section describes the DNS data files and the resource records each file should contain. Standard Resource Record FormatIn the standard resource record format, each line of a data file is called a resource record (RR), which contains the following fields separated by white space:
The order of the fields is always the same; however, the first two are optional (as indicated by the brackets), and the contents of the last vary according to the record-type field. The name FieldThe first field is the name of the domain that applies to the record. If this field is left blank in a given RR, it defaults to the name of the previous RR. A domain name in a zone file can be either a fully qualified name, terminated with a dot, or a relative name, in which case the current domain is appended to it. The ttl FieldThe second field is an optional time-to-live field. This specifies how long (in seconds) this data will be cached in the database before it is disregarded and new information is requested from a server. By leaving this field blank, the ttl defaults to the minimum time specified in the Start-Of-Authority (SOA) resource record. If the ttl value is set too low, the server will incur a lot of repeat requests for data refreshment; if, on the other hand, the ttl value is set too high, changes in the information will not be timely distributed. Most ttl values should be initially set to between a day (86400) and a week (604800). Then, depending on the frequency of actual change of the information, you can change the appropriate ttl values to reflect that frequency. Also, if you have some ttl values that have very high numbers because you know they relate to data that rarely changes. When you know that the data is now about to change, reset the ttl to a low value (3600 to 86400) until the change takes place. Then change it back to the original high value. All RR's with the same name, class, and type should have the same ttl value. The class FieldThe third field is the record class. Only one class is currently in use: IN for the TCP/IP protocol family. The record-type FieldThe fourth field states the resource record type. There are many types of RR's; the most commonly used types are discussed in Resource Record Types. The record-specific-data FieldThe contents of the record-specific-data field depend on the type of the particular resource record. Although case is preserved in names and data fields when loaded into the name server, all comparisons and lookups in the name server database are case insensitive. However, this situation might change in the future; thus, you should be consistent in your use of lower and uppercase. Special Resource Record CharactersThe following characters have special meanings. Table 5–5 Special Resource Record Characters
Most resource records have the current origin appended to names if they are not terminated by a dot (.). This is useful for appending the current domain name to the data, such as machine names, but might cause problems when you do not want this to happen. You should use a fully qualified name ending in a period if the name is not in the domain for which you are creating the data file. Control EntriesThe only lines that do not conform to the standard RR format in a data file are control-entry lines. There are two kinds of control entries: $INCLUDE() and $ORIGIN(). The $INCLUDE EntryAn include line begins with $INCLUDE in column 1, and is followed by a file name (known as the $INCLUDE file). This feature is particularly useful for separating different types of data into multiple files as in this example:
The line is interpreted as a request to load the /etc/named/data/mailboxes file at that point. The $INCLUDE command does not cause data to be loaded into a different zone or tree. The command allows for data for a given zone to be organized in separate files. For example, mailbox data might be kept separately from host data using this mechanism. Use of $INCLUDE statements and files is optional. You can use as many as you wish, or none at all. The $ORIGIN() EntryThe $ORIGIN() command is a way of changing the origin in a data file. The line starts in column 1, and is followed by a domain name. It resets the current origin for relative domain names (for example, not fully qualified names) to the stated name. This is useful for putting more than one domain in a data file. Note – You cannot use $ORIGIN() for putting more than one zone in a data file. Use of $ORIGIN() commands in a data file is optional. If there is no $ORIGIN() statement the default origin for DNS data files is the domain named in the second field of the master or slave line of the named.conf file. Resource Record TypesThe most commonly used types of resource records are listed in Table 5–6. They are usually entered in the order shown in Table 5–6, but that is not a requirement. Table 5–6 Commonly Used Resource Record Types
Start-of-Authority record (SOA)Example 5–19 shows the syntax of a start-of-authority (SOA) resource record. Example 5–19 SOA Record Format
The SOA record designates the start of a zone. The zone ends at the next SOA record. The SOA record fields are described below. The name FieldThis field indicates the name of the zone. Note that the zone name must end with a trailing dot. For example: doc.com. is correct, while doc.com is wrong. The class FieldThis field is the address class. For example, IN for Internet (the most commonly used class). The SOA FieldThis field is the type of this resource record. The origin FieldThis field is the name of the host where this data file resides. Note that this host name must end in a trailing dot. For example, dnsmaster.doc.com. is correct, but dnsmaster.doc.com is wrong. The person-in-charge FieldThis field is the email address of the person responsible for the name server. For example, kjd.nismaster.doc.com. Again, this name must end with a trailing dot. The serial FieldThis field is the version number of this data file. You must increment this number whenever you make a change to the data: slave servers use the serial field to detect whether the data file has been changed since the last time they copied the file from the master server. The refresh FieldThis field indicates how often, in seconds, a slave name server should check with the master name server to see if an update is needed. For example, 7200 indicates a period of two hours. The retry FieldThis field indicates how long, in seconds, a slave server is to retry after a failure to check for a refresh. The expire FieldThis field is the upper limit, in seconds, that a slave name server is to use the data before it expires for lack of getting a refresh. The ttl FieldThis field is the default number of seconds to be used for the time-to-live field on resource records that do not have a ttl specified elsewhere. There should only be one SOA record per zone. Example 5–20 is a sample SOA resource record. Example 5–20 Sample SOA Resource Record
Name Server (NS)The Example 5–21 example shows the syntax of a name-server (NS) resource record. Example 5–21 NS Record Format
The name-server record lists by name a server responsible for a given domain. The name field lists the domain that is serviced by the listed name server. If no name field is listed, then it defaults to the last name listed. One NS record should exist for each master and slave server for the domain. Example 5–22 is a sample NS resource record. Example 5–22 Sample NS Resource Record
Address (A)The Example 5–23 example shows the syntax of an address (A) resource record. Example 5–23 Address Record Format
The A record lists the address for a given machine. The name field is the host name, and the address is the IP address. One A record should exist for each address of the machine (in other words, routers, or gateways require at least two entries, a separate entry including the IP address assigned to each network interface). Example 5–24 Sample Address Record
Host Information (HINFO)The Example 5–25 example shows the syntax of a host-information (HINFO) resource record. Example 5–25 HINFO Record Format
The HINFO contains host-specific data. It lists the hardware and operating environment that are running at the listed host. If you want to include a space in the machine name or in the entry in the hardware field, you must surround the entry with quotes. The name field specifies the name of the host. If no name is specified, it defaults to the last in.named host. One HINFO record should exist for each host. Example 5–26 is a sample HINFO resource record. Example 5–26 Sample HINFO Resource Record
Because the HINFO field provides information about the machines on your network, many sites consider it a security risk and no longer use it. Well-Known Services (WKS)The Example 5–27 example shows the syntax of a well-known services (WKS) resource record. Example 5–27 WKS Record Format
The WKS record describes the well-known services supported by a particular protocol at a specified address. The list of services and port numbers come from the list of services specified in the services database. Only one WKS record should exist per protocol per address. Example 5–28 is an example of a WKS resource record. Example 5–28 Sample WKS Resource Record
The WKS record is optional. For security reasons, most sites no longer provide this information. Canonical Name (CNAME)Example 5–29 shows the syntax of a canonical-name (CNAME) resource record. Example 5–29 CNAME Record Format
The CNAME specifies a nickname or alias for a canonical name. A nickname should be unique. All other resource records should be associated with the canonical name and not with the nickname. Do not create a nickname and then use it in other resource records. Nicknames are particularly useful during a transition period, when a machine's name has changed but you want to permit people using the old name to reach the machine. Nicknames can also be used to identify machines that serve some specific purpose such as a mail server. Example 5–30 is a sample CNAME resource record. Example 5–30 Sample CNAME Resource Record
Pointer Record (PTR)Example 5–31 shows the syntax for a PTR resource record. Example 5–31 PTR Record Format
A pointer record allows special names to point to some other location in the domain. In the example, PTRs are used mainly in the in-addr.arpa. records for the translation of an address (the special name) to a real name. When translating an address, if the domain is fully qualified only the machine identification number need be specified. PTR names should be unique to the zone. The PTR records Example 5–32 sets up reverse pointers for the special in-addr.arpa domain. Example 5–32 Sample PTR Resource Record
Mail Exchanger (MX)Example 5–33 shows the syntax for a mail-exchanger (MX) resource record. Example 5–33 MX Record Format
The MX resource records are used to specify a machine that knows how to deliver mail to a domain or specific machines in a domain. There might be more than one MX resource record for a given name. In Example 5–34, Seismo.CSS.GOV. (note the fully qualified domain name) is a mail gateway that knows how to deliver mail to Munnari.OZ.AU. Other machines on the network cannot deliver mail directly to Munnari. Seismo and Munnari might have a private connection or use a different transport medium. The preference-value field indicates the order a mailer should follow when there is more than one way to deliver mail to a single machine. The value 0 (zero) indicates the highest preference. If there is more than one MX resource record for the same name, records might or might not have the same preference value. You can use names with the wildcard asterisk (*) for mail routing with MX records. There are likely to be servers on the network that state that any mail to a domain is to be routed through a relay. In Example 5–34, all mail to hosts in domain foo.com is routed through RELAY.CS.NET. You do this by creating a wildcard resource record, which states that the mail exchanger for *.foo.com is RELAY.CS.NET. The asterisk will match any host or subdomain of foo.com, but it will not match foo.com itself. Example 5–34 Sample MX Resource Record
Chapter 6 DNS Troubleshooting (Reference)This chapter described some common DNS problems and how to solve them. Clients Can Find Machine by Name but Server CannotSymptoms DNS clients can find machines by either IP address or by host name, but the server can only find machines by their IP addresses. Probable cause and solution This is most likely caused by omitting DNS from the hosts line of the server's nsswitch.conf file. For example, a bad hosts line might look like this: hosts: files When using DNS you must include dns in the hosts record of every machine's nsswitch.conf file. For example:
or
Changes Do Not Take Effect or Are ErraticSymptom You add or delete machines or servers but your changes are not recognized or do not take effect. Or in some instances the changes are recognized and at other times they are not yet in effect. Probable cause The most likely cause is that you forgot to increment the SOA serial number on the master server after you made your change. Since there is no new SOA number, your slave servers do not update their data to match that of the master so they are working with the old, unchanged data files. Another possible cause is that the SOA serial number in one or more of the master data files was set to a value lower than the corresponding serial number on your slave servers. This could happen, for example, if you deleted a file on the master and then recreated it from scratch using an input file of some sort. A third possible cause is that you forgot to send a HUP signal to the master server after making changes to the primary's data files. Diagnosis and solution First, check the SOA serial numbers in the data file that you changed and the corresponding file on the slave server.
DNS Client Cannot Lookup “Short” NamesSymptoms Client can lookup fully qualified names but not short names. Possible cause and solution Check the client's /etc/resolv.conf file for spaces at the end of the domain name. No spaces or tabs are allowed at the end of the domain name. Reverse Domain Data Not Correctly Transferred to slaveWhile zone domain-named data is properly transferred from the zone master server to a zone slave server, the reverse domain data is not being transferred. In other words, the host.rev file on the slave is not being properly updated from the primary. Possible causes Syntax error in the slave server's boot file. Diagnosis and Solution Check the slave server's boot file. Make sure that the master server's IP address is listed for the reverse zone entries just as it is for the hosts data. Server Failed and Zone Expired ProblemsWhen a slave server cannot obtain updates from its master, it logs a master unreachable message. If the problem is not corrected, the slave expires the zone and stops answering requests from clients. When that happens, users start seeing server failed messages. Symptoms
Note that if the problem is with a slave server, some users could still be successfully obtaining DNS information from the master and thus operating without experiencing any difficulty. Possible causes The two most likely causes for these problems are network failure and a wrong IP address for the master in the slave's boot file. Diagnosis and solution
rlogin, rsh, and ftp ProblemsSymptoms
Possible causes
Diagnosis and solution Check the appropriate hosts.rev file and make sure there is a PTR record for the user's machine. For example, if the user is working at the machine altair.doc.com with an IP address of 192.168.0.1, the doc.com master server's doc.rev file should have an entry like:
If the record is missing, add it to the hosts.rev file and then reboot the server or reload its data as explained in How to Force in.named to Reload DNS Data. Check and correct the NS entries in the hosts.rev files and then reboot the server or reload its data as explained in How to Force in.named to Reload DNS Data. Other DNS Syntax ErrorsSymptoms Error messages in console or syslog with operative phrases like the following are most often caused by syntax errors in DNS data and boot files. Check the relevant files for spelling and syntax errors. A common syntax error is misuse of the trailing dot in domain names (either using the dot when you should not, or not using it when you should). See Setting Up DNS Servers. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||