Search The Hostwinds Guides Knowledge Base

How To Set Up DNS Using Bind On Your Server

Share This Article

In this guide, you will learn how to set up an internal DNS using Apache and bind. This will allow you to configure private Nameservers and connect your domain to your server without using a control panel. You will need to connect to your server via SSH or another method such as VNC. For more information on how to connect to your server via SSH, please review Connecting To Your Server Via SSH.

To run bind and continue with this guide, you will need to have the LAMP stack installed on your Hostwinds Server.

Configuring Your DNS

Step one: You will need to install the Bind9  packages, you can do this by running.

Step two: Once these are installed you will need to edit your named.conf.options file, you can do this by running nano or your favorite text editor.

You will need to add your IP addresses as “Forwarders”, if you have two IPv4 addresses you can use those or you can use your main ipv4 and you ipv6. You will also need to add   listen-on { localhost; 104.XXX.XXX.XX; };  using your main IP. You can see an example of this below.

Step Three: You will need to add  DNS zones in your named.conf.default-zones using your text editor:

You will need to add two zones, the first would be for your domain, The second would be for your reverse dns,

Step Four: You will need to create the actual zone files you just called, so let’s use nano to edit this file

This file should look like this, replacing  with your desired domain and the IP address with the one supplied by your server

You will also have to create a zone file for your  reverse DNS the same way you made the above, however, the file should look like this

Every time you update these file you will have to increase the Serial number. You should also be sure to replace  with the actual domain name.

Step Five:  You can check your configuration and zones by running these commands

If the configuration is good name-checkconf  will return nothing.

If the zone is good named-checkzone  will return output similar to the following:

Step six: Once all of the configurations and zones check out you will need to Restart and enable bind9

Step Seven: Finally you will need to tell the server to check named.conf , you can do this by editing your /etc/default/bind9  file to check named.conf

The file should look like similar to this:

Step seven: Check bind9 status for  any additional errors

If should look like this:

Setting up Glue Records

To complete making your nameservers you will need to go to your domain registrar and set up ‘glue records’ on your nameservers. This is where you connect the nameserver records to the IP of the nameservers. Here is an example of a domain registered at Hostwinds to help you set this up by following the example in this guide.

Step One: In your Client Area Select the Domains dropdown and select My Domains from the drop down

Step two: Select the drop down next to the wrench icon and choose Manage Domains

Step Three: On the left side in the Manage box, choose Private Nameserver

Step Four: Here is where you input the and and their associated IP’s

Testing Your Domain

Once all of the above steps are complete you should be ready to go! To test your domain, you can use websites like or the dig  command using SSH.

The output of this command should look like this:

Adding Another Domain

To add another domain, you would need just need to add another zone file.

Here is an example of what that zone file would look like for our additional zone file