ProTechGurus

Learn By Self | Served By Experts

Buy Here: AWS Cloud Step By Step Lab Manual Guide

Deal of the month

Windows Server 2016 Hands-on Practical Guide with Virtual Machine Lab Setup

  • CCNA
    • Routing
    • Switching
    • IPv6
    • Security
    • Juniper
  • GNS3 Labs
  • VMware
  • VirtualBox
  • Windows
    • Windows Server 2016
    • Windows 10
    • SCVMM
  • Linux
    • Ubuntu
    • RHEL
  • AWS Cloud
  • Blogging Tutorilas
    • Internet Tips
You are here: Home / Linux / How To Configure DNS Server In Ubuntu 17.04 Linux

May 7, 2017 by ProTechGurus

How To Configure DNS Server In Ubuntu 17.04 Linux

The actual communication between two systems happens with the help of IP addresses. However, remembering IP addresses of each system is difficult, especially when there are millions of websites and domain servers exist. Domain Name Server (DNS) is a service that allows you to create a mapping table that resolves IP addresses to the respective domain names. The full domain name is consists of a hostname and a domain name. It also referred as Fully Qualified Domain Name (FQDN). In this tutorial, we are going to explain how to configure DNS server in Ubuntu Linux. We are using the latest version of Ubuntu that is Ubuntu 17.04. However, the same steps can also be used to configure DNS server in other Linux variants and other versions of Ubuntu such as Ubuntu 16.04 and Ubuntu 14.04.

Also, read:

  • Configure DNS server in Windows Server 2016
  • Configure DHCP server in Ubuntu 17.04

The following three types of DNS servers can be configured on a Linux system.

  1. Caching-only DNS server
  2. Primary DNS server
  3. Secondary DNS server

1. Configuring Caching-only DNS server in Ubuntu Linux

Caching-only DNS server does not host its own DNS zone data. When a domain name query is resolved by a client, caching name server stores the resolved queries in its cache. When the same query is requested by another client, caching name server answers the query from its cache thus reducing the query resolve time.

In order to configure caching-only DNS server in Ubuntu Linux, the following steps need to be followed.

Installing DNS Server Packages

In the Linux systems, for DNS server, you need to install bind9 and dnsutils packages using the following commands:

sudo apt install bind9
sudo apt install dnsutils

Updating named.conf File

After installing the required packages, you need to modify the DNS server configuration file. Most of the Ubuntu and other Linux platforms, the main DNS configuration file is /etc/bind/named.conf.

Configuring caching-only DNS server is pretty simple. In fact, the /etc/bind/named.conf.options file is already configured to act as the caching-only name server. You just need to replace the current IP address with your upside DNS server IP address in the /etc/bind/named.conf.options file. The following figure shows how to configure caching-only DNS server in Ubuntu.

Configure Caching-Only DNS server in Ubuntu Linux

After updating the DNS configuration file, restart the DNS service, and verify that the service is running properly.

sudo systemctl restart bind9.service
sudo systemctl status bind9.service

Start and enable bind service in Ubuntu Linux

That’s all you need to configure caching name server in Ubuntu Linux. Isn’t it so easy?

Configure Primary Master DNS Server

To configure primary master DNS server in Ubuntu Linux, you need to update the /etc/bind/named.conf.local configuration file. In this file, you configure DNS forward lookup and reverse lookup zone. Forward lookup zone is used to resolve an FQDN name to IP address and reverse lookup zone is used to resolve IP address to the FQDN name.

  • Recommended: Configure LAMP in Ubuntu Linux

Configure Forward Lookup Zone Options

We assume that protechgurus.com is your domain name and db.protechgurus.com would your zone data file name. Considering this, the DNS configuration file for the primary master DNS server should look like the following.

zone "protechgurus.com" {
type master;
file "/etc/bind/db.protechgurus.com";
};

Creating Forward Lookup Zone Data File

Now, you need to create a zone file that you have mentioned in the previous file, named as db.protechgurus.com, under the /etc/bind directory. To simplify your tasks, you can use the /etc/bind/db.local template file to create /etc/bind/db.protechgurus.com file.

sudo cp /etc/bind/db.local /etc/bind/db.protechgurus.com

Now edit the zone file as per your network settings. Replace the highlighted text with your actual DNS server IP address and domain name.

Create lookup zone files in Ubuntu 17.04 Linux

In the above file, whenever you make any changes, you also need to increase the serial number by plus 1 (+1).

Finally, save the zone file and restart the DNS service.

sudo systemctl restart bind9.service

Configuring Reverse Lookup Zone

Once you configured and updated the forward lookup zone, the next step is to configure reverse lookup zone. In the DNS configuration file, add the reverse lookup zone entry. In our example, the reverse lookup zone name is 0.16.172.in-addr-arpa and the zone data file name is db.172.16. The final content of the /etc/bind/named.conf.local file should look like as follow:

Configure Reverse Lookup Zone in ubuntu Linux

Like the forward lookup zone, you also need to create and update the reverse lookup zone file named as /etc/bind/db.172.16. For this, copy the template file as /etc/bind/db.172.16 and update the file content as shown below.

 

Create Reverse Lookup Zone database file in Ubuntu Linux

Similar to the forward lookup zone, whenever there a modification happens in the reverse lookup zone file, you need to increase the serial number by +1 each time.

Before proceeding further, please check that your zones are configured properly and the syntax of the configuration file is OK. For this, execute the commands as shown in the following figure.

Check DNS server configuration file syntax

Finally, restart the bind the service. If everything goes fine, the service should start and status should be shown as running.

sudo systemctl restart bind9.service
sudo systemctl status bind9.service

Verifying DNS Server Configuration

Now, you have successfully configured caching-only and primary master DNS server in Ubuntu Linux. We will cover secondary DNS server in a separate tutorial.

Now to further verify, execute the following commands:

dig <your-domain-name>
ping <your-domain-name>
ping <ns.your-domain-name>

We recommend you to spend some time with the above commands and review the output details of each command.

Do subscribe us to stay connected with us and get notified for upcoming tutorials.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)
❮❮ Previous Post
Next Post ❯ ❯

Windows Server 2016 – Lab Manual Guide

The Best CCNA Self Study Guide

Like Us

AWS Cloud Self Learning Guide

Recent Posts

  • How To Scan EC2 Instances Using Amazon Inspector
  • Creating and Using AWS NAT Gateways – Step By Step
  • How To Create and Use AWS Internet Gateways
  • How To Create and Manage AWS Virtual Private Cloud (VPC)
  • Step By Step Guide To Create AWS Account Without Credit Card

Newsletter

  • Contact Us
  • Terms and Conditions
  • About Us

Copyright © ‘2019’ · ProTechGurus ·

Pretty Chic Theme By: Pretty Darn Cute Design