Various bits of flotsam that washed up on our computers, before we moved to a better blog system in November 2004. Now a repository for YouTube videos and testing new tools. Go to http://www.b12partners.net/wp/ for more recent content.

Saturday, June 12, 2004

Start local DNS in OS X

Interesting little unix cook-book, borrowed from MacMegasite, on how to run your own DNS server if you have Mac OS X (or linux perhaps, but your specifics might be slightly different). I only know enough unix to be dangerous, but as long as you are able to follow instructions carefully, you won't muck anything up.

MacMegasite - Speed up web browsing with a local name server:
...
Instead of using your ISP's name server, you can run a caching name server on your own computer. By handling DNS lookups locally and caching results, it will make opening pages quite a bit faster. Here's how to do it:

1. Using your favorite text editor, edit /etc/named.conf and uncomment the following line:
// query-source address * port 53;
It should become:
query-source address * port 53;


2. Edit /etc/hostconfig and change the following line:
DNSSERVER=-NO-
to:
DNSSERVER=-YES-
This will cause the local name server to start automatically.

3. Run the following command in the terminal:
sudo /usr/sbin/named
This will start the name server without rebooting.

4. Finally, go to network preferences and in the TCP/IP settings for Ethernet or Airport enter 127.0.0.1 as the DNS server address.

Try opening a page in the web browser and enjoy the speedup!


If you have an Apple discussions login (and you should if you use Panther or Jaguar), here is more details details.


---update
I hope you read all of this posting before jumping in, because these next steps are important too. Make a backup of your files before you change them (sudo cp hostconfig hostconfig.backup) and (sudo cp named.conf named.conf.backup).

I used 'sudo pico' to edit the files, textedit didn't have root access. I think there is a way around that, but always wanted to try using pico. I had never used pico before, and while it is was a little awkward, I figured out how to open the correct file. There is undoubtedly an easier way, but I managed. Also, when changing the TCP/IP settings, leave the ones already entered, and just move 127.0.0.1 to the first DNS address.

If you use little snitch (which keeps track of outgoing traffic, nice little utility, worth the money), you will see a message that /usr/bin/host wants to make a UDP connection to port 53. This means you didn't fuck anything up, and that you are running your own DNS server. Whoo hooo!

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home