Tiger Tips: How to enable BIND

dankogai@dan.co.jp

Prologue

Sometimes you want to have your DNS Server locally. Your Mac may be mobile and the DNS server fed by your (DHCP|PPP) server might be slow or not working at all. Or your Mac may be an intranet server with its own intranet domain.

Before Tiger

Fortunately, every Mac OS X, "Server" or not, comes with BIND, a de-facto standard DNS server suite. Up until Mac OS X v10.4 ("Tiger" as follows), all it took to enable was to modify a line in /etc/hostconfig

.
DNSSERVER=-YES-

and issue a commend:

sudo /System/Library/StartupItems/BIND/BIND start

Unfortunately, that is no longer true. Instead of StartupItems, Tiger now uses what is called launch daemon to interface BIND.

In this document, you will learn how to enable BIND on Tiger. This document DOES NOT discuss how to manage it. Once up and running, BIND on Tiger is no different from an ordinaryBIND 9.

Disclaimer

I, Dan Kogai, makes no guarantee whatsoever on this document. Use at your own risk.

Before You Start

You need a root priviledge for further tasks. To gain the root privileged, launch Terminal and issue the command below.

sudo -s

Edit /etc/named.conf

First you need to teak /etc/named.conf, the main configuration file. Unlike previous versions of Mac OS X, the default does not work.

Before you edit the file, back it up with the command below:

cp -p /etc/named.conf /etc/named.conf.dist

In this document, the BIND is configured as cache-only server. Here is the difference from the default.

# diff -u /etc/named.conf.dist /etc/named.conf 
--- /etc/named.conf.dist        2005-04-30 02:21:39.000000000 +0900
+++ /etc/named.conf     2005-04-30 02:41:43.000000000 +0900
@@ -1,7 +1,7 @@
 //
 // Include keys file
 //
-include "/etc/rndc.key";
+//include "/etc/rndc.key";
 
 // Declares control channels to be used by the rndc utility.
 //
@@ -13,8 +13,8 @@
 // Default controls
 //
 controls {
-       inet 127.0.0.1 port 54 allow {any;}
-       keys { "rndc-key"; };
+       inet 127.0.0.1 port 54 allow {any;};
+       //keys { "rndc-key"; };
 };
 
 options {

In short, just comment out all entries related to rndc-key.

Edit /System/Library/LaunchDaemons/org.isc.named.plist

The next file to edit is /System/Library/LaunchDaemons/org.isc.named.plist. That is the major differnce between Tiger and the predecessors.

As always, backup the original file.

cp -p /System/Library/LaunchDaemons/org.isc.named.plist /System/Library/LaunchDaemons/org.isc.named.plist.dist

Then edit. Here is the difference.

# diff -u  /System/Library/LaunchDaemons/org.isc.named.plist.dist /System/Library/LaunchDaemons/org.isc.named.plist 
--- /System/Library/LaunchDaemons/org.isc.named.plist.dist      2005-04-30 02:08:46.000000000 +0900
+++ /System/Library/LaunchDaemons/org.isc.named.plist   2005-04-30 02:09:34.000000000 +0900
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>Disabled</key>
-       <true/>
+       <false/>
        <key>Label</key>
        <string>org.isc.named</string>
        <key>OnDemand</key>

As you see, the only difference is one tag. And here is the whole.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>Label</key>
        <string>org.isc.named</string>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/sbin/named</string>
                <string>-f</string>
        </array>
        <key>ServiceIPC</key>
        <false/>
</dict>
</plist>

Restart launchd via launchctl

Now let's use launchctl to start named

# launchctl stop org.isc.named        # for sure
# launchctl unload org.isc.named.plist
# launchctl load org.isc.named.plist  # for sure
# launchctl start org.isc.named

Set up clients

Now all you need to do is add 127.0.0.1 in Network Preference Panel. Enjoy!