BIND, DNS, Godaddy, Ubuntu

Customer purchased Comcast Business cable for their primary internet provider. They also purchase a domain name through godaddy. I used to think godaddy was a horrible/awful/pile of dung, but now that I’m starting to find out where everything is hidden they’re turning out to be moderately OK.

Background:
Ubuntu 10.04 x32 Server LAMP
BIND 9.7.0
Webmin 1.510
Sonicwall TZ180W Enhanced
Godaddy account information and domain name

I updated their ubuntu server from 9.04 to 9.10, then now to 10.04. I installed webmin as the customer wanted a GUI to be able to edit the config files. And, despite resistance from CLI users, webmin is a pretty powerful suite. I secured the server as much as I could. I then made sure that port 53 for UDP and TCP was opened for DNS to/from the server.

Now the fun part begins. Login on your webmin server (usually https://webminserver’sIPaddress:10000) and navigate to Servers > Bind DNS Server.

Create BIND Master Zone
Under Existing DNS Zones, Click on Create Master Zone.

Zone type: Forward
Domain Name/Network: yourdomain.tld
Records file: Automatic
Master server: yourdomain.tld, uncheck Add NS record for master server
Email address: admin@yourdomain.tld
Use zone template: No
IP Address for template records: Your PUBLIC IP address
Add reverses for template addresses: Yes
Leave the TTL as is, unless you want longer/shorter timeouts
Click Create

Add Name Records
Now you should be in the Address Records for your new domain. If not, navigate to Servers > BIND DNS Server > Existing DNS Zones > Yourdomain.tld > Address.
NOTE: Notice the ‘.’ at the end of the names.

Name: ns1.yourdomain.tld.
Time-To-Live: default
Address: Your PUBLIC IP address
Update reverse: Yes
Create
Name: ns2.yourdomain.tld.
Time-To-Live: default
Address: Your PUBLIC IP address
Update reverse: Yes
Create
Name: yourdomain.tld.
Time-To-Live: default
Address: Your PUBLIC IP address
Update Reverse: Yes
Create
Name: www.yourdomain.tld.
Time-To-Live: default
Address: Your PUBLIC IP address
Update Reverse: Yes
Create

Add Name Servers
Return to Record Types. Now click on Name Server.

Zone Name:
Time-To-Live: 300
Name Server: ns1.yourdomain.tld.
Create
Zone Name:
Time-To-Live: 300
Name Server: ns2.yourdomain.tld.
Create

Restart BIND
You have two ways to do this (well, more than that, but you know how it is):

1.) Login as root using SSH to your BIND Server. Run:
sudo /etc/init.d/bind9 restart
2.) On Webmin, Click on System > Bootup and Shutdown > bind9
Click on the Restart Now button

Test your configuration:

Login to your BIND Server using SSH
nano /etc/resolv.conf
search yourdomain.tld
nameserver 127.0.0.1
Add ‘#’ to any other name servers in the list
Save and Exit Nano
dig yourdomain.tld
Make sure the HEADER Flags have: qr aa rd ra. Well, the ‘aa’ is the most important part – that shows it’s that authority for this domain.

Change the DNS Servers of your Godaddy account

Login on your godaddy domain manager
I added the DNS entries for ns1.yourdomain.tld and ns2.yourdomain.tld in the custom DNS area. Point those both to your public IP address.
In the lower left corner of the Domain Manager screen (after you click on the domain you want to manage) you will see a Host Summary area.
Add NS1.yourdomain.tld with your PUBLIC IP
Add NS2.yourdomain.tld with your PUBLIC IP
I had to wait 5 minutes or so before everything was happy.

Now change the DNS servers from NSxx.DOMAINCONTROL.COM to NS1.YOURDOMAIN.TLD AND NS2.YOURDOMAIN.TLD.

If you get a message about your name servers not being registered, you probably forgot to add the domains into the Host Summary area. Either that or you haven’t waited long enough.

7 thoughts on “BIND, DNS, Godaddy, Ubuntu”

  1. This works well, thanks. I cant seem to ping the domain name or ssh using the domain name though. What else do I need to config? Thanks

  2. It depends a lot on the TTL. Also, if you’re using a windows machine, run an ipconfig /flushdns and then try pinging the domain name once again. If it’s still not resolving, check the system logs on the linux side to see if there are any errors – and then recheck the work.

  3. really great help … thank you for this tutorial.
    As when I open the domain it was opening main page of webmin I thought I should create separate space / folder for my domain
    I also wanted to host multiple domains …

    so after your tutorial last step I clicked on SERVER and APACHE SERVER then I clicked on CREATE VIRTUAL HOST

    in Handle connections to address I selected Specific address .. and added my domain there.

    I selected document root as /var/www/mydomain.com
    at the end I selected Server Name as mydomain.com
    rest I left same with their default value

    at the end i clicked on apply changes and then stop and start apache

    my website is opening and rest is working fine but the problem start when i start adding multiple domains … and also i want to know how i can use same DNS for my all domains … plz help thanks

  4. You said “Now change the DNS servers from NSxx.DOMAINCONTROL.COM to NS1.YOURDOMAIN.TLD AND NS2.YOURDOMAIN.TLD.” I dont get if that is for the actual DNS server or for your OTHER domains that will use you new DNS server? Could you please explain.

  5. Ali,

    Apache with virtualhosts and DNS – they definitely need each other, but this post was only about setting up DNS. Explaining Vhosts would eat up more than I can post in the comments. Basically you’ll need a DNS entry for each subdomain/domain. Remember, www is technically a subdomain of http://www.domain.tld and domain.tld is the parent. You’ll need apache to have virtualhosts as well – restart apache after you add them.

  6. It,

    I’m not really following on your question – I’m assuming that you want to create ns1 and ns2.yourdomain.tld. You can add other domains to use those name servers so long as you have those other domains setup on BIND.

    So, you can have say mydomain123.tld using ns2.yourdomain.tld as the name server. Not every domain will have it’s own name server!

Leave a Reply

Your email address will not be published. Required fields are marked *