Выбрать главу

This record associates an alias with a host's canonical hostname. It provides an alternate name by which users can refer to the host whose canonical name is supplied as a parameter. The canonical hostname is the one the master file provides an A record for; aliases are simply linked to that name by a CNAME record, but don't have any other records of their own.

PTR

This type of record is used to associate names in the in-addr.arpa domain with hostnames. It is used for reverse mapping of IP addresses to hostnames. The hostname given must be the canonical hostname.

MX

This RR announces a mail exchanger for a domain. Mail exchangers are discussed in "Mail Routing on the Internet". The syntax of an MX record is:

[domain] [ttl] [class] MX preference host

host names the mail exchanger for domain. Every mail exchanger has an integer preference associated with it. A mail transport agent that wants to deliver mail to domain tries all hosts who have an MX record for this domain until it succeeds. The one with the lowest preference value is tried first, then the others, in order of increasing preference value.

HINFO

This record provides information on the system's hardware and software. Its syntax is:

[domain] [ttl] [class] HINFO hardware software

The hardware field identifies the hardware used by this host. Special conventions are used to specify this. A list of valid "machine names" is given in the Assigned Numbers RFC (RFC-1700). If the field contains any blanks, it must be enclosed in double quotes. The software field names the operating system software used by the system. Again, a valid name from the Assigned Numbers RFC should be chosen.

An HINFO record to describe an Intel-based Linux machine should look something like:

tao 36500 IN HINFO IBM-PC LINUX2.2

and HINFO records for Linux running on Motorola 68000-based machines might look like:

cevad 36500 IN HINFO ATARI-104ST LINUX2.0

jedd 36500 IN HINFO AMIGA-3000 LINUX2.0

Caching-only named Configuration

There is a special type of named configuration that we'll talk about before we explain how to build a full name server configuration. It is called a caching-only configuration. It doesn't really serve a domain, but acts as a relay for all DNS queries produced on your host. The advantage of this scheme is that it builds up a cache so only the first query for a particular host is actually sent to the name servers on the Internet. Any repeated request will be answered directly from the cache in your local name server. This may not seem useful yet, but it will when you are dialing in to the Internet, as described in Chapter 7, Serial Line IP and Chapter 8, The Point-to-Point Protocol.

A named.boot file for a caching-only server looks like this:

; named.boot file for caching-only server

directory    /var/named

primary 0.0.127.in-addr.arpa named.local; localhost network

cache  .  named.ca; root servers

In addition to this named.boot file, you must set up the named.ca file with a valid list of root name servers. You could copy and use Example 6.10 for this purpose. No other files are needed for a caching-only server configuration.

Writing the Master Files

Example 6.10, Example 6.11, Example 6.12, and Example 6.13 give sample files for a name server at the brewery, located on vlager. Due to the nature of the network discussed (a single LAN), the example is pretty straightforward.

The named.ca cache file shown in Example 6.10 shows sample hint records for a root name server. A typical cache file usually describes about a dozen name servers. You can obtain the current list of name servers for the root domain using the nslookup tool described in the next section.[43]

Example 6.10: The named.ca File

;

; /var/named/named.ca Cache file for the brewery.

; We're not on the Internet, so we don't need

; any root servers. To activate these; records, remove the semicolons.

;

;. 3600000 IN NS A.ROOT-SERVERS.NET.

;A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4

;. 3600000 NS B.ROOT-SERVERS.NET.

;B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107

;. 3600000 NS C.ROOT-SERVERS.NET.

;C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12

;. 3600000 NS D.ROOT-SERVERS.NET.

;D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90

;. 3600000 NS E.ROOT-SERVERS.NET.

;E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10

;. 3600000 NS F.ROOT-SERVERS.NET.

;F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241

;. 3600000 NS G.ROOT-SERVERS.NET.

;G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4

;. 3600000 NS H.ROOT-SERVERS.NET.

;H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53

;. 3600000 NS I.ROOT-SERVERS.NET.

;I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17

;. 3600000 NS J.ROOT-SERVERS.NET.

;J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10

;. 3600000 NS K.ROOT-SERVERS.NET.

;K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129

;. 3600000 NS L.ROOT-SERVERS.NET.

;L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12

;. 3600000 NS M.ROOT-SERVERS.NET.

;M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33

;

Example 6.11: The named.hosts File

;

; /var/named/named.hosts Local hosts at the brewery

; Origin is vbrew.com

;

@ IN SOA vlager.vbrew.com. janet.vbrew.com. (

 2000012601; serial

 86400; refresh: once per day

 3600; retry: one hour

 3600000; expire: 42 days

 604800; minimum: 1 week

)

 IN NS vlager.vbrew.com.

;

; local mail is distributed on vlager

 IN MX 10 vlager

;

; loopback address

localhost. IN A 127.0.0.1

;

; Virtual Brewery Ethernet

vlager IN A 172.16.1.1

vlager-if1 IN CNAME vlager

; vlager is also news server

news IN CNAME vlager

vstout IN A 172.16.1.2

vale IN A 172.16.1.3

;

вернуться

43

Note that you can't query your name server for the root servers if you don't have any root server hints installed. To escape this dilemma, you can either make nslookup use a different name server, or use the sample file in Example 6.10 as a starting point, and then obtain the full list of valid servers.