So I recently made a document detailing how to make an actual DNS caching server using Linux, and since Mac OS X and Linux are both Unix based, they are very similar. Mac OS X doesn't have a built in DNS cache, like winblows does. However by creating a caching server,or a local cache you can fix that, and have it cache even better than Winblows can.
Anyone who has 'switched' to the Mac, or has experience on a PC, knows that the PC makes the Mac look like a dog when it comes to web browsing. This is true for all browsers on the Mac. It turns out this has less to do with the end-user applications and really centers around DNS (Domain Name Server) lookups. The major bottleneck in our systems seems to be initial contact with the websites. We are having to make every single request to an external DNS server, thus creating a lag in initial response. Considering OS X is UNIX, this is completely unnecessary. We have a perfectly good DNS server (BIND) that is turned off by default.
In order to drastically improve web browsing experience, we will enable a local caching name server. This will require sudo privileges and comfort in the Terminal. We will be using the command-line text editor pico here, as Text Edit will not execute properly as root.
A few things to remember before we start...
And now, the step-by-step...
- Capitalization is important!
- Terminal commands are shown in orange, and preceded by a # prompt character or a dollar sign $ (don't type that!).
- Comments are shown below commands, and /* surrounded by comment markers */. Don't type the comments.
- Text you should be pasting is in orange italics.
# rndc-confgen > /etc/rndc.conf
- Start a root Terminal session
Open a Terminal session and launch a root shell by typing sudo bash. The rest of the instructions assume every step is done in this root shell!- Set up your machine to run the BIND server.
/* creates rndc.conf and generates key */
# head -n 6 /etc/rndc.conf > /etc/rndc.key
/* parses the key into the proper file */
# pico -w /etc/named.conf
/* opens the BIND configuration file for editing in the text editor */
Add the following into the options section, where x.x.x.x represents the IP addresses of either your ISP, or other DNS servers, known to you (Google for DNS servers if you don't know of any) I use OpenDNS which is 208.67.222.222 and 208.67.220.220:
forwarders
{
x.x.x.x;
x.x.x.x;
};
Save the file and quit the editor. Hit Control-O, Enter, then Control-X.
3. Create StartupItem for DNS [10.4 only; otherwise jump to next step]
It seems as if Tiger has removed the (already disabled in Panther) DNS Server completely from StartupItems. We have to add it if running Tiger or newer.
# cd /System/Library/StartupItems
# mkdir BIND
# cd BIND
# touch BIND; pico -w BIND
/* Create first of two files, then open it in text editor */
Copy the following into the file, save it, and exit:
#!/bin/sh
. /etc/rc.common
if [ "${DNSSERVER}" = "-YES-" ]; then
ConsoleMessage "Starting BIND DNS Server"
/usr/sbin/named
fi
$ touch StartupParameters.plist; pico -w StartupParameters.plist
/* Create and open second of two files needed */
Copy the following into the file,save it, and exit:
{
Description = "Local Caching DNS Server";
Provides = ("DNS Server");
OrderPreference = "None";
Messages =
{
start = "Starting BIND DNS Server";
stop = "Stopping BIND DNS Server";
};
}
$ chmod +x BIND
/* Make the script executable so it can actually be run */
4. Enable DNS on boot
# pico -w /etc/hostconfig
/* Open the file OS X reads to start services */
Change it to make DNSSERVER=-YES-. Here Tiger or newer users will have to add this value; Panther users will simply change it to -YES-. Save the file and exit.
5. Finish up with root
# exit
/* End root shell */
6. Tell OS X to use your local DNS
Open System Preferences, then the Network preferences panel. Change your 'DNS Server' setting to 127.0.0.1 for all the connections you use. This step is crucial, as failing to do so will make all your hard work completely useless.
Finally, either reboot, or issue the following command in the terminal:
$ sudo /System/Library/StartupItems/BIND/BIND
That's it -- enjoy your new internet connection!
Credit to http://hints.macworld.com/article.ph...50420025219402









1Likes
LinkBack URL
About LinkBacks
Reply With Quote

