How To Install and Configure DNS Server on Ubuntu 16.04 LTS

r00t April 18, 2017

Install and Configure DNS Server on Ubuntu 16.04 LTS

In this tutorial we will show you how to install and configuration DNS server on Ubuntu 16.04 LTS. For those of you who didn’t know, BIND is a widely used DNS Server. Ideally, DNS server consist of 2 machines that work together simultaneously, one act as master and the other one act as slave. If your domain registrar doesn’t provide you a free DNS server, or if you want to create a custom DNS record, then you might need to host your own DNS server.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation and configure DNS server on ubuntu on a Ubuntu 16.04 (Xenial Xerus) server.

Install and Configure DNS Server on Ubuntu 16.04 LTS

HostRolePrivate FQDNPrivate IP Address
ns1Primary DNS Server108.100.100.1
ns2Secondary DNS Server108.100.100.2
hostGeneric Hostidroot.net192.30.35.67

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

Step 2. Installing DNS Server Bind9.

After updating the system, run the following command to install BIND9 packages which are used to setup DNS server:

Step 3. Configure Bind9.

It is time to show you a basic configuration how to setup your domain to resolve to your server:

Step 4. Configure Local File.

Next, we will configure the local file, to specify our DNS zones:

Because in the above config we put zone file in “/etc/bind/zones/idroot.net.db”, then we need to create the folder and file:

Install and Configure DNS Server on Ubuntu 16.04 LTS

And then restart bind9 service to take effect the changes:

Step 5. Configure Secondary DNS Server.

Configure slave bind options:

Restart bind9 service to take effect the changes:

This DNS server will not work until you change your domain’s nameserver. It can be done from your domain’s registrar website. In this scenario, we change nameserver to:

ns1.idroot.net
ns2.idroot.net

Step 6. Testing BIND.

Finally, this test could be done either on the DNS server itself or from another server, or from your own PC. In this case, we will do the test from another server running Ubuntu OS.

Install dnsutils:

Do the dig dns test:

Install and Configure DNS Server on Ubuntu 16.04 LTS

Do the nslookup dns test:

Install and Configure DNS Server on Ubuntu 16.04 LTS

Congratulation’s! You have successfully installed DNS server. Thanks for using this tutorial for installing DNS server on Ubuntu 16.04 LTS  (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official bind9 web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!
Share on Google+0Share on Facebook0Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon1Share on Reddit1Pin on Pinterest1
The Tags:

Leave a Comment