| Disclaimer: Some of these Tutorials show you how to muck about with your OS. Follow these directions at your own risk. They worked for me, but I cannot be held responsible if you have any problems or cause any damage to your system. |
|
I am by no means an expert, so if you know something I don't, or know of a better way to do this, please feel free to contact me and tell me about it. Any comments, criticism, or praise can be directed at kurt@macresistance.com.
Setting up your OS X machine as a DNS server:
CLI = Command Line Interface (Terminal)
GUI = Graphical User Interface (Aqua)
To begin, you need to be able to login as root, either by typing "su" then the root password in the terminal, or by logging in as root in Aqua's login window.
(Here's an example of the directions)
| CLI |
GUI |
| su |
Log out, then log back in as root |
|
You can actually do this entirely in Aqua - you don't have to use the Terminal. Both ways have advantages and disadvantages, so I'll include directions for both ways and you can choose the way you like best.
(If you're doing this in Aqua, you'll need to use TinkerTool to have hidden system files shown in the Finder, and have a text editor like TextEdit or BBEdit handy.)
.01
go to "var"
| CLI |
GUI |
| cd /var/ |
double click the "var" folder in your startup drive. (Assuming you're in "icon" view.) |
|
.02
create a directory in var called "named"
| CLI |
GUI |
| mkdir named |
make a new folder called "named" |
|
.03
go into the newly created "named"
| CLI |
GUI |
| cd named/ |
double click "named" folder |
|
.04
add a file called "root.hints"
| CLI |
GUI |
pico root.hints
(paste in the contents of the root.hints file listed below into the Terminal window)
(press "control-o" keys (O as in Oliver) to save)
(now it's asking what file name to save to, it's already there, so just press "return")
(press "control-x" keys to exit pico) |
make a new document to work with in TextEdit or BBEdit, paste in the contents of the root.hints file listed below, and save as "root.hints" in the "named" folder" |
|
This is the contents of root.hints, and I'm given to understand that it needs updating, occaisionally. I'll look into that some other day.
;
; There might be opening comments here if you already have this file.
; If not don't worry.
;
. 6D IN NS M.ROOT-SERVERS.NET.
. 6D IN NS I.ROOT-SERVERS.NET.
. 6D IN NS E.ROOT-SERVERS.NET.
. 6D IN NS D.ROOT-SERVERS.NET.
. 6D IN NS A.ROOT-SERVERS.NET.
. 6D IN NS H.ROOT-SERVERS.NET.
. 6D IN NS C.ROOT-SERVERS.NET.
. 6D IN NS G.ROOT-SERVERS.NET.
. 6D IN NS F.ROOT-SERVERS.NET.
. 6D IN NS B.ROOT-SERVERS.NET.
. 6D IN NS J.ROOT-SERVERS.NET.
. 6D IN NS K.ROOT-SERVERS.NET.
. 6D IN NS L.ROOT-SERVERS.NET.
;
M.ROOT-SERVERS.NET. 6D IN A 202.12.27.33
I.ROOT-SERVERS.NET. 6D IN A 192.36.148.17
E.ROOT-SERVERS.NET. 6D IN A 192.203.230.10
D.ROOT-SERVERS.NET. 6D IN A 128.8.10.90
A.ROOT-SERVERS.NET. 6D IN A 198.41.0.4
H.ROOT-SERVERS.NET. 6D IN A 128.63.2.53
C.ROOT-SERVERS.NET. 6D IN A 192.33.4.12
G.ROOT-SERVERS.NET. 6D IN A 192.112.36.4
F.ROOT-SERVERS.NET. 6D IN A 192.5.5.241
B.ROOT-SERVERS.NET. 6D IN A 128.9.0.107
J.ROOT-SERVERS.NET. 6D IN A 198.41.0.10
K.ROOT-SERVERS.NET. 6D IN A 193.0.14.129
L.ROOT-SERVERS.NET. 6D IN A 198.32.64.12
.05
Next, we'll make another directory called "pz" - this is where what my Linux friend refers to as the "zone files" will reside.
| CLI |
GUI |
| mkdir pz |
make a new folder called "pz" inside of "named" |
|
.06
Go into "pz"
| CLI |
GUI |
| cd pz/ |
double click "pz" folder |
|
.07
make a new file called "127.0.0" in "pz"
| CLI |
GUI |
pico 127.0.0
(paste in the contents of the 127.0.0 file listed below into the Terminal window)
(press "control-o" keys (O as in Oliver) to save)
(now it's asking what file name to save to, it's already there, so just press "return")
(press "control-x" keys to exit pico) |
make a new document to work with in TextEdit or BBEdit, paste in the contents of the root.hints file listed below, and save as "127.0.0" in the "pz" folder" |
|
It's the same steps for making a file as step .04, but with the following content:
@ IN SOA mydomain.org. hostmaster.mydomain.org. (
5 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
IN NS mydomain.org.
1 PTR localhost.
mydomain.org. IN A 64.193.168.57
www IN A 64.193.168.57
IN MX 10 mydomain.org.
.08
Next, make another file in the same directory, with the same exact content but this time name it "mydomain.org.zone" - It would be easiest simply to make a copy of "127.0.0" and rename it.
| CLI |
GUI |
| cp 127.0.0 mydomain.org.zone |
"option-drag" 127.0.0 to another spot within the "pz" window, select the new file, hit "return," and change the name of "127.0.0 copy" to "mydomain.org.zone" |
|
(Just in case you didn't realize, you're supposed to replace "mydomain.org" with your actual domain. Mine, for examle, was "macresistance.com" )
.09
Ok, now let's move over to "etc"
| CLI |
GUI |
| cd /etc/ |
browse back up to the root level of your startup drive, and double click "etc" |
|
.10
Make a new file in "etc" called "named.conf"
| CLI |
GUI |
pico named.conf
(paste in the contents of the named.conf file listed below into the Terminal window)
(press "control-o" keys (O as in Oliver) to save)
(now it's asking what file name to save to, it's already there, so just press "return")
(press "control-x" keys to exit pico) |
make a new document to work with in TextEdit or BBEdit, paste in the contents of the named.conf file listed below, and save as "named.conf" in the "etc" folder" |
|
// Config file for caching only name server
options {
directory "/var/named";
// Uncommenting this might help if you have to go through a
// firewall and things are not working out. But you probably
// need to talk to your firewall admin.
query-source port 53;
};
zone "." {
type hint;
file "root.hints";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "pz/127.0.0";
};
zone "mydomain.org" {
type master;
file "pz/mydomain.org.zone";
};
.11
One Odd thing I've found
The Linux Tutorials on how to do this, all specify another step: having your machine look to itself as DNS server. This is done by editing the /etc/resolv.conf
It's supposed to look something like this:
search subdomain.mydomain.edu mydomain.edu
nameserver 127.0.0.1
But, whenever I've tried to do this, I stop seeing the Internet at all.
Obviously, I'm missing something. Everything works fine without this step, though, so don't worry, yet. I'll do some more research on this, and post what I find here.
.12
Ok. Finally, let's set up "named" (the DNS server software) to automatically startup when the computer boots up.
Go to /System/Library/StartupItems/ (you should be able to do this, by now)
| CLI |
GUI |
| cd /System/Library/StartupItems/ |
From the root level of the startup disk, browse through System to Library to StartupItems. |
|
.13
Make a new directory (I called mine "Named" for obvious reasons.)
| CLI |
GUI |
| mkdir Named |
Create a new folder called "Named" in the StartupItems folder. |
|
.14
inside of /System/Library/StartupItems/Named/ make a new file called "Named."
| CLI |
GUI |
pico Named
(paste in the contents of the Named file listed below into the Terminal window)
(press "control-o" keys (O as in Oliver) to save)
(now it's asking what file name to save to, it's already there, so just press "return")
(press "control-x" keys to exit pico) |
make a new document to work with in TextEdit or BBEdit, paste in the contents of the named.conf file listed below, and save as "Named" in the "Named" folder. |
|
This is the content for the "Named" file:
#!/bin/sh
##
# named.
##
. /etc/rc.common
ConsoleMessage "Starting DNS Server"
named
.15
Make another file inside of /System/Library/StartupItems/Named/ called "StartupParameters.plist" with the following content:
| CLI |
GUI |
pico StartupParameters.plist
(paste in the contents of the StartupParameters.plist file listed below into the Terminal window)
(press "control-o" keys (O as in Oliver) to save)
(now it's asking what file name to save to, it's already there, so just press "return")
(press "control-x" keys to exit pico) |
make a new document to work with in TextEdit or BBEdit, paste in the contents of the named.conf file listed below, and save as "StartupParameters.plist" in the "Named" folder. |
|
{
Description = "named";
Provides = ("named");
Requires = ("Network");
OrderPreference = "None";
Messages =
{
start = "Starting named";
stop = "Stopping named";
};
}
One more thing about these shell scripts:
I set up a second OS X machine the other day, and everything worked except for these shell scripts that I put in /System/Library/StartupItems/Named/ - so I had to manually start named by typing "named" into the Terminal as root.
I don't know why the scripts didn't work. They work fine on my Cube. The only difference that I know of is that on the new machine I used a text editor to create the scripts from scratch (like I describe in the tutorial) and on my Cube, I actually copied some existing scripts to that new /System/Library/StartupItems/Named/ folder, and then renamed and modified them.
Ok, that's it. If everything works, next time you restart your machine, your DNS server should be running. Then go to networksolutions.com and sign your machine up as a host.
These directions are slightly different for setting up multiple domains, but not much. Essentially adding more entries in the named.conf pointing to an additional .zone file for each domain in /var/named/pz/. As a matter of fact, I have 5 domains pointing at my server. This also requires a little mucking about with virtualhosting in the /etc/httpd/httpd.conf but it's nothing difficult.
|
| Coming Soon |
Crontab!
More Manuals
NetworkSolutions Tricks
|
|
|