Mac Web Servers: May 27, 2001

Trying Your Hand at DNS

by David L. Hart

Now that you’ve studied and committed to memory the information on DNS from my previous three columns, I can tell you’re ready to go out and reconfigure the 13 DNS root servers. But since their current administrators probably won’t let you anywhere near those servers, I thought I’d help you out with a quick trip through configuring a basic DNS server on your own machine.

Without further ado, you should run out and download MacDNS from the Apple Web site (http://asu.info.apple.com/swupdates.nsf/artnum/n11264) — not because I necessarily recommend using MacDNS as your primary DNS server, but because (a) it’s free and (b) it has the minimal features that I’ve highlighted in my DNS columns. For a more robust, full-featured DNS server on the Mac (and available on Mac OS X), you should stick with the BIND freeware or QuickDNS Pro from Men and Mice Software (http://www.menandmice.com/).

To run a name server, you’ll need to register a domain name, which I’ll assume you’ve done already. Installing MacDNS involves downloading the BinHex archive file, uncompressing it, and copying the files from the resulting disk image onto your hard drive. After installing and starting the MacDNS application, there are three basic steps you need to perform:

CREATING A ZONE FILE

The first time you open the MacDNS program, name service starts automatically, but you need to enter some host information before MacDNS can start identifying your computers. As you should recall, you need to configure MacDNS with details about your particular domain.

  1. Choose New Zone File from the File menu. A Zone Information dialog box appears, with an untitled host list window for the zone file underneath it, as shown here.

  2. Enter your domain name in the Domain Name box.
  3. Type the DNS name of your server in the Primary Server box.
  4. Type the name of your zone’s secondary server zone in the Secondary Server box. You may remember from previous columns that you also need a secondary name server for your domain. Your ISP may be willing to let you use their name server as your secondary name server, but you should check with them. MacDNS only operates as a primary name server.
  5. Type your e-mail address in the Administrator box.
  6. Type an amount in the Refresh Interval box and choose a unit of time from the adjacent pop-up menu (or confirm the recommended default value). Do the same for the Retry Interval, Expire Interval, and Minimum TTL boxes.
  7. Click OK. If you recall my previous column, you have just entered the information necessary to create a Start of Authority (SOA) record. To ensure that you have a permanent record of the host information for your zone, be sure to save the zone file by choosing Save from the File menu.

CONFIGURING YOUR PARENT SERVER

Your DNS server must rely on other DNS servers (called parent servers) for answers to queries that it doesn’t have in its own database. In general, your server should use the DNS server for your ISP as its parent. MacDNS uses the DNS information from the TCP/IP control panel as its default list of parent servers. If that information has not been configured or is incorrect, you will have to configure the parent server(s) yourself.

  1. Choose Set Parent Servers from the Hosts menu. A dialog box opens, shown below.

  2. Make sure that the default parent server information is correct; if it isn’t, contact your ISP to get the correct information and enter it here.
  3. If you want to add alternate parent servers, type the appropriate information in the Server Name and the Server IP Address boxes, respectively.
  4. Click OK.

ADDING HOSTS

Now we’re getting to the good stuff: Setting up the address records for the hosts in your domain. MacDNS shields you from the gory details of the various record types. Be grateful. For each host computer in your domain, you’ll need to add the appropriate information.

  1. Choose Add Permanent Host from the Hosts menu. The Host Information dialog box appears, shown below.

  2. Type the full name of the host in the Host Name box. The host name is "real" name permanently assigned to the host.
  3. Type the IP address assigned to the host in the IP Address box.
  4. Type an amount in the "Time to Live" box and choose a time limit. The Time to Live indicates how long information about this host can live in another DNS server’s cache.
  5. (Optional) Type the name of aliases for this host in the Aliases text box. Separate different aliases by commas, and each name must be a fully qualified domain name.
  6. (Optional) Enter mail exchanger information for the host, if different from the zone’s mail exchanger. Each entry must consist of a numeric preference value, followed by a space, then the name of the mail host.
  7. (Optional) Select the computer type and operating system for the host you’re adding. If you leave "None" selected, no hardware or software information will be returned for queries from other DNS servers.
  8. Repeat steps 1 through 7 for all the hosts in your domain.

Be sure to save your DNS configuration. For the hardy souls out there, you can check out the raw DNS data by opening the MacDNS file in a text editor. The records will be bared in all their naked glory. You’ll be glad you had MacDNS’s visual interface to step you through it. (Since MacDNS uses standard DNS syntax, it can also open DNS files that originated on Unix systems.)

That’s all there is to a basic DNS server, but the complexity and possibilities grow if you manage more than one domain or lots of hosts. I’ve only really scratched the surface of what you can do with a DNS server. For example, it’s possible to have your DNS server distribute the requests to your Web server address across more than one computer. If you want to pursue it further, there are numerous books on the subject of DNS and name servers. As for the Mac Web Servers column, this is the last unpublished column that I had previously written for MacCentral. I'm going to have to come up with some new material now. Stay tuned!