Self-run DNS

Last night, as ***some|http://www.techpopuli.net/news/04/001076.html*** ***people|http://offonatangent.blogspot.com/2005/04/comcast-internet-was-down-hard.html*** noted, ***Comcast|http://www.comcast.net/*** high speed internet had an outage. Smartypants techie guy that I am, I realized that the ‘internet’ was not ‘down’, per se, but rather that Comcast’s DNS servers were acting up. Some people have solved this problem by putting in other DNS server addresses, like 4.2.2.1 and 4.2.2.2. I took another approach – I set up our Macs to be their own DNS servers. Here’s how.

The ***BIND|http://www.isc.org/index.pl?/sw/bind/*** name server is built into Mac OS X. It’s simply a matter of activating it in your system’s configuration files, starting the server, and then telling your Mac to use itself as the name server.

Note: This method requires the use of the Terminal application. Be brave – it’s not as hard as it looks!

Activating BIND
1) Open the “Terminal” application from the Applications -> Utilities folder.
2) At the Terminal prompt, type:

ccc|sudo pico /etc/hostconfig”|ccc

and press return.
3) Enter your administrator password when prompted, and press return. (If you don’t think you know it, you probably do. It’s the same password you used for the first account you set up on the computer.)
4) Look for a line in the file that says:

ccc|DNSSERVER=-NO-|ccc

5) Use your arrow keys to navigate down to this line.
6) Use the delete key to delete NO and change it to YES.
7) Type Ctrl-X to exit.
8) Type Y to say that you do want to save.
9) Press Enter to confirm the file name.

Starting BIND
1) Still in Terminal, type:

ccc|sudo SystemStarter start BIND|ccc

at the prompt and press return. Type in your password and press return, if requested.
2) You should see a bunch of messages, but at least one should say:

ccc|Starting named|ccc

3) The BIND DNS server is now running on your Mac!

Telling your Mac to use itself as the name server
1) Go to the Apple Menu
2) Select System Preferences
3) Select the Network Preferences
4) Choose the TCP/IP tab (click the ‘Configure’ button if you don’t see that tab).
5) Under DNS Servers, clear out any entries, and replace them with 127.0.0.1 (this is a special IP address that refers to your own computer).
6) Click ‘Apply’.
7) You are now running your very own local DNS server!

As long as your connection to the Internet is up and running, your machine will act as a ***caching name server|http://www.faqs.org/docs/securing/chap21sec164.html***. It will go out to the Internet’s network of “root servers” to find the IP addresses, and then it will cache the results locally so that you can use them again when needed.

Let me know if you have any questions or comments about this method.

Also, if you happen to end up using this method, could you leave a comment and let me know what version of Mac OS X you are running?

Update
In Mac OS X 10.4 (Tiger), Apple has for some reason removed the startup script. Here is an article on ***setting up a new one|http://www.macosxhints.com/article.php?story=20050420025219402***.

Update 2
As some of the people in that article noted, there are even ***better ways to enable caching DNS in Tiger|http://www.dan.co.jp/cases/macosx/tiger/bind-tiger.html***.
I’ve actually gone back to just using Comcast’s DNS – it’s best to use your ISP’s DNS unless it absolutely isn’t working. I’d consider this tip to be more of a troubleshooting effort than a permanent solution. And it certainly isn’t meant to ‘speed up’ your browsing.

5 thoughts on “Self-run DNS

  1. Pingback: Universal Hub

  2. Pingback: Docs.Rage.Net

Leave a Reply

Your email address will not be published. Required fields are marked *