I would like to setup my own dns servers ns1.myhostingdomain.com and ns2.myhostingdomain.com
I have two seperate servers to use, one as primary and the other as a slave. My goal is to set it up for a web hosting setup. I would like to be able to add new domains (zones) and then have the newly purchased (hosted) domain point to ns1.myhostingdomain.com and ns2.myhostingdomain.com

I figured I would start with the primary first without the slave added and then once I have the primary working I would try to get the slave working. I have bind9 installed on ubuntu 9.10 (karmic)
It comes partially configured I guess. So far I have done the following:

Modified: /etc/bind/named.conf.options - Changed forwarders to the name servers that are above my ns1.myhostingdomain.com server (the hostname is not actually ns1, it is poseidon.*, if that matters at all)

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders.
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

    forwarders {

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };

I added a zone to /etc/bind/named.conf.local

#start_zone myhostingdomain.com
zone "myhostingdomain.com" {
        type master;
        file "/etc/bind/zones/myhostingdomain.com.db";

then I created the zone file /etc/bind/zones/myhostingdomain.com.db

; BIND data file for local loopback interface
$TTL    604800
@       IN      SOA     ns1.myhostingdomain.com. dnsadmin.myhostingdomain.com. (
                        20100809001     ; Serial
                        1H              ; Refresh
                        15M             ; Retry
                        4W              ; Expire
                        1H              ; Negative Cache TTL
@       IN      NS      ns1.myhostingdomain.com.
@       IN      NS      ns2.myhostingdomain.com.
@       IN      A
ns1     IN      A
ns2     IN      A

is there something I am missing or am I doing this completely wrong?

  • That's pretty much how I set mine up, going off of memory...are you having problems with it or are you just doing a sanity check? – peelman Aug 9 '10 at 19:49

Do you have the zone pointed to your DNS server at the registrar level? A dig +trace ns1.myhostingdomain.com should give you some more information as well as the output from cat /etc/resolv.conf

  • Awesome, I added the ns1 and ns2 to my godaddy account for the domain in the hosts section and it works now. plus I had forgotten to restart bind :) thanks for the help – gasdeveloper Aug 9 '10 at 20:35
  • glad to be of help...just to clarify for the populace at large, if this were an internal only DNS server, all you would have to do is make sure your internal clients were pointed at the server. But, for a publicly facing server, your registrar has to point to your server(s) – Greeblesnort Aug 10 '10 at 4:41

Restart bind, check the syslog for errors and you should be done.

As a step for securing the system you should probably limit recursion to only your address space.

options {
    // uncomment this section to limit recursion to internal hosts
    allow-recursion {
  • I don't understand the recursion stuff yet. But thanks for the advice. I am waiting for my changes at the registrar to propigate then I will be testing the changes again. – gasdeveloper Aug 9 '10 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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