Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set my server's IP as DNS and then be able to to make domains like, and also, and * point to the same server where I will be hosting these files in apache.

I installed macports, and here is my configuration file: /opt/local/etc/named.conf

    // Declares control channels to be used by the rndc utility.
    // This must be enabled on Mac OS X Server for Server Status to provide valid
    // information! (Remove the leading slashes to enable.)
    //        **** STUFF YOU MIGHT NEED TO ENABLE ****
     controls {
          unix "/var/run/ndc" perm 0600 owner 0 group 0;
          inet port 54 allow {any; };
    // It is recommended that be the only address used.
    // This also allows non-privileged users on the local host to manage
    // your name server.

    options {
            directory "/opt/local/var/named";

            // uncomment the following lines to turn on DNS forwarding,
            // and change the forwarind ip address(es) :
            //forward first;
            //forwarders {
            //      123,123.123.123;

            listen-on-v6 { none; };
            listen-on {; };

            // to allow only specific hosts to use the DNS server:
            //allow-query {

            dnssec-validation auto;
            pid-file "/opt/local/var/run/";

    // a caching only nameserver config

    zone "." IN {
            type hint;
            file "db.cache";

    zone "localhost" IN {
            type master;
            file "db.localhost";
            allow-update { none; };

    zone "" IN {
            type master;
            file "db.127.0.0";
            allow-update { none; };

So I wanna be able to make all these point to the same server where bind is installed:

How can I do this? I would also like to ask how can I get a good documentation or book about bind. The documents I found on web were either too technical or too simplistic.

Or is there an easier interface to work with bind?

share|improve this question
As for bind guides - there's excellent (and free) DNS for Rocket Scientists: and Oreilly's DNS and BIND is great. – Sandman4 Nov 26 '11 at 16:13
That book is pretty hardcore, not suitable for someone who doesn't wanna be a dns Einstein, but only wants to make the thing work once and for all, It seems to be the most popular book on bind though, many thanks for sharing – user893730 Nov 26 '11 at 22:28
Oreilly's first chapters are quite simple how-to with an example of config file and zone. Should be enough to start with. I think there's some GUI for bind, maybe it doesn't work on mac. And doesn't macos have it's own DNS server ? – Sandman4 Nov 27 '11 at 7:16
Btw, if you want it easy, why not to use some hosted DNS service ? like - should be easier and more reliable. – Sandman4 Nov 27 '11 at 7:18
up vote 1 down vote accepted

You need to edit you named.conf to add a zone like:

zone "" IN {
    type master;
    file "";
    allow-update { none; };

Then create a zone file in /opt/local/var/named named That file should look like:

$TTL 21600 
@                      3600 SOA   <your ns A record>. (
                        ; address of responsible party
                              2011072601                          ; serial number
                              3600                       ; refresh period
                              600                        ; retry period
                              604800                     ; expire time
                              60                       ) ; minimum ttl
                                NS    <YOUR_NS_A_RECORD>.

                                A     <YOUR_IP>
*               IN      A     <YOUR_IP>

Wildcarding it is you best options since you then don't have to worry about it again.

I highly recommend getting a copy of DNS and BIND

share|improve this answer
Thank you Zypher, can you tell me how I can find my ns A record? – user893730 Nov 26 '11 at 4:34
You need to set it in your zone file - if everything is under <YOUR_IP> then the * will cover you (however you should really manually specify it as nsX IN NS <IP> – Zypher Nov 26 '11 at 5:45

This is what worked for me in the zone file, I used what Zypher suggested in named.conf

$TTL 10800 IN SOA (
    2011071800  ;Serial
    86400       ;Refresh
    3600        ;Retry
    604800      ;Expire
    345600      ;Negative caching TTL
www IN  CNAME 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.