Setting up local DNS on OS X Leopard

I found that my internet connection sometimes worked quite slow, and I also found out that the DNS lookups were slowing my relatively fast internet connection down.

First of all! Performing this is at your own risk and I will not take responsibility for you fucking up your network settings. Please do know, that this will require you to be familiar with the Terminal. You don’t need to be a pro, but knowledge helps.

Let’s get started!

If you have a favorite editor, go use.. In this example we will be using nano as this is easy to use and present on standard Leopard installs.

We need an rndc key to make this work. create one with:

# sudo rndc-confgen -a

Now we need to go root…

# sudo su –

It will ask you for your password.. type it in.

# cd /System/Library/StartupItems
# mkdir BIND
# cd BIND
# nano -w BIND

Copy the following text and paste it into your terminal:


. /etc/rc.common

if [ “${DNSSERVER}” = “-YES-” ]; then
ConsoleMessage “Starting BIND DNS Server”

To exit and save: Press CTRL+O, Enter, CTRL+X

Next, we need another file:

# nano -w StartupParameters.plist

Add the following text to it:

Description = “Local DNS”;
Provides = (“DNS Server”);
OrderPreference = “None”;
Messages =
start = “Starting DNS Server”;
stop = “Stopping DNS Server”;

Make sure, that the file is executable:

# chmod +x BIND

Next, we need to make sure it starts up when you boot your Mac.

# nano -w /etc/hostconfig

Add this line to it, if it does not already exist:


If it does already exist, change the -NO- to a -YES-

No more root..

# exit

Make it run:

# sudo /System/Library/StartupItems/BIND/BIND

Now you can exit your terminal. We are almost done, now all we need is to configure OS X to actually use it’s own DNS server.

Go to: System Preferences > Network

Mark the currently active network adapter and change the DNS Server address to
The two grey ip addresses are your ISP nameservers, they will disappear when you click the field. If you want them back again, simply do not write anything in the field.

Click Apply.
Go to to test it!

This entry was posted in Random. Bookmark the permalink. Both comments and trackbacks are currently closed.