Configure DNS Server on Ubuntu

Network Ubuntu

The Domain Name System (DNS) is a hierarchical distributed naming system for computers connected over network. It resolves ip address correspondence to a domain name. There are four type of dns servers .
This article will help you to configure dns server (Domain Name System) using bindpackages on Ubuntu, Debian and LinuxMint systems. Bind is also known as named service. Most of web hosting providers already provide dns server for their clients but if you want to set up your own dns server (Domain name system) go through this article.

If you are CentOS or Redhat user visit this article to set up DNS server.

Install DNS Packages

Bind9 is the most popular dns server used world-wide. It is available under default apt-get repositories. So use following commands to install Bind9 domain name system.

Create Forward Zone File

As we are using temporary domain named Create a forward dns zone file under /etc/bind directory.

and add following content

Create Reverse Zone File

If required, configure rDNS zone also for your ip address and domain names to resolve reverse dns. For example we are using ip range in our intranet. Create reverse dns file /etc/bind/db.0.168.192 with following content.

and add following content

Add Zone Entry in Main Configuration

Now edit bind configuration file (/etc/bind/named.conf.local) and add the forward and reverse zone entries there like below.

Append following content

Verify Configuration Files

After making all configuration, verify all files using following commands.

If any of above commands returns any error or warning, Please fix that before proceeding to next step.

Restart DNS

After successfully verification of all files, let’s restart bind9 service.

Test Setup

Finally your dns server is successfully configured and ready to use. Make sure your client system is using your dns server as default dns server. Let’s verify that DNS is properly responding on queries. Below is example commands to test it.

Verify Forward Zone:

Verify Reverse Zone: