Quick pic of the Day
Working on pyStones
Py-Stones update
Quick DNS setup guide for Leopard
Ready for a quick setup of DNS server bind on OS X? Here we go! You need admin access rights to do this, so to make it easy, I suggest you do all the file editing in the terminal with vi or pico. This guide is best for a one domain, one IP setup, although it is true for any configuration with some changes. Use this guide if you know nothing about DNS and want to set things up quick or if you know what you’re doing and need to know which files OS X is using. ….not valid for Leopard Server!
- Open /etc/named.conf in your favorite editor (or sudo vi /etc/named.conf)
Add a foward zone for each do main, like this. The zone is the name of the domain you want to host and the file is what file will have to domain’s configuration in it. You need one for each domain you’re hosting.
Add a reverse zone for each IP subnet which will be used for the domains.Set the zone to the first three digit groups of the subnet, backwards. So, 192.168.0.x will be written 0.168.192. I know, it’s a little weird. In both the foward and reverse files, what file name you choose is really arbitrary. You just have to be consistent. The files themselves will be in /var/named.- Save the changes to named.conf and close the file. The file should look something like this: (if you can’t see the whole thing, copy and paste it into an editor)
- Save the changes to named.conf and close the file.
- Create the foward zone file we specified earlier (named.kiwimod.com) in /var/named. This directory will also contain named.local and named.ca. Just leave these files alone. They are fine as they are.
- Open the file in an editor. (Again, sudo is very useful for this.) Type in this, changing the names to fit your site:
- Save and close the file.
- Create the reverse zone file (named.129.234.60 or whatever you called it) in /var/named. Edit the file to read:
- Just change the IP and domain bits to be your settings. The digit 2 in address to host mappings is the last number of the IP address. In this example, only one IP is being used for the domain, but using more than one works pretty much the same way, you just need additional reverse zone files and reverse lookup settings in named.conf.
// // Include keys file // include "/etc/rndc.key"; // Declares control channels to be used by the rndc utility. // // It is recommended that 127.0.0.1 be the only address used. // This also allows non-privileged users on the local host to manage // your name server. // // Default controls // controls { inet 127.0.0.1 port 54 allow {any;} keys { "rndc-key"; }; }; options { directory "/var/named"; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53; }; // // a caching only nameserver config // zone "." IN { type hint; file "named.ca"; }; zone "localhost" IN { type master; file "localhost.zone"; allow-update { none; }; }; zone "0.0.127.in-addr.arpa" IN { type master; file "named.local"; allow-update { none; }; }; zone "kiwimod.com" IN { type master; file "named.kiwimod.com"; }; zone "129.234.60.in-addr.arpa" IN { type master; file "named.129.234.60"; allow-update { none; }; }; logging { category default { _default_log; }; channel _default_log { file "/Library/Logs/named.log"; severity info; print-time yes; }; };
; DNS for KiwiMod.com $TTL 86400 ; 1 day kiwimod.com. IN SOA ns.kiwimod.com. admin.kiwimod.com. ( 2003040101 ; Serial 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day ; name servers @ IN NS ns.kiwimod.com. @ IN MX 10 mail.kiwimod.com. ; host to address mappings @ IN A 60.234.129.2 mail IN A 60.234.129.2 ns IN A 60.234.129.2 ; aliases www IN CNAME mail amy IN CNAME mail
; Reverse lookup for 60.234.129.2 $TTL 86400 ; 1 day 129.234.60.in-addr.arpa IN SOA ns.kiwimod.com. root.kiwimod.com. ( 2003040101 ; Serial 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 week 86400 ) ; Minimum TTL of 1 day ; name servers 129.234.60.in-addr.arpa IN NS ns.kiwimod.com. ; address to host mappings 2 IN PTR kiwimod.com. 2 IN PTR ns.kiwimod.com. 2 IN PTR mail.kiwimod.com.
That’s it. All you have to do now is start up named and see if it worked.
In the terminal, type:
sudo named -c /etc/named.conf
to start up the nameserver. To see if the name is resolving, try digging it:
dig kiwimod.com
or
dig 192.168.your.IP
Use your own IP of course, the IP of the server that is. You should get back some information about the server, like what IP the nameserver has. If not, then something has gone horribly wrong!
Serving with OS X: BIND and DNS
This is part one to setting up a basic, all-in-one server under Mac OS X. We’re going to investigate how the Mac stacks up as a server in setup and customization. For the most part, I’m going to assume you’ve either heard about or tinkered with these tools in some other *nix before.
( Skip to Quick Setup Guide! )
Let’s use an example setup. You have one computer, a mac, that you want to run apache and maybe some other services on. You also want to host your own domain. You’re probably going to want to decide how the domain is going to be organized ahead of time. This makes things a lot easier when you go to setup the actual domain structure in BIND. But lets get down to some basics about DNS first.
About DNS
In order for networked computers to translate between a shortcut name, like google.com, and a real IP address, they have to contact a Domain Name Server. DNS servers keep a list of what computer names are associated with what address. There is a lot (a lot!) more to know about DNS than this, so I refer you to the info list at the bottom for more. Ok, so how do we do this?
What you need
- a domain name which has been registered for you to an IP you are using on your server.
- a mac
- know what hosts you need. Hosts come in front of the domain, like www or mail.
Putting it together, an example
Our example is an all-in-one web, mail, and dns server. We’re going to call it kiwimod.com. OS X comes with the DNS server application, Bind, already installed and ready. (Bind and Named, pronounced name-d, are two names for one service.) We just have to add some information to the configure files to be off and running. Take a look at /etc/named.conf
Named.conf has the information about what domains your site is running and what files contain the configuration settings. In this file what you have to do is add a zone for each domain and each IP address your going to setup. Let’s use our example domain, kiwimod.com.
Continue to the DNS setup guide…
Running the daemon
Once you’re satisfied with your setup you want to make sure Bind starts up whenever your computer does. To do this, you need to add a startup script to your mac’s startup items. We’ll cover that in another guide. See you next time!

