What is DNS ?

In this Tutorial we are going to learn How to Configure BIND On Linux CentOS/RHEL7 so lets first start with DNS.

DNS (Domain Name System) is a hierarchical structure that is responsible for resolving hostnames into their numerical IP addresses for computer systems and vice versa.

`
  • Domain Name System has been used on the internet and in the private networks as well.

Type of DNS Servers

Primary or Master DNS Server

A Primary or Master DNS server has authority of its domain and it is maintainer of domain’s original zone data. Domain zone files are maintained on the Primary or Master DNS Server and they can propagate domain’s record to secondary servers.

Secondary or Slave DNS Sever

A Secondary or Slave DNS server also has the authority of its domain and they stores domain’s zone data files as well but they just copied these files from primary DNS server. Whenever primary server made the update to domain zone files, the secondary server simply copy the updated file from primary server automatically. Secondary or Slave DNS servers are used to offloading the primary.

Caching-Only DNS Server

A Caching DNS Server doesn’t have any authority for any domain. They just answer client queries after getting reply from Pimary or Secondary DNS servers.

Caching servers are mostly used for redundancy, load sharing and provide faster response to the client queries.

  • Caching-Only DNS Server delivers data from the memory rather than from the disk.

What is BIND in Linux ?

BIND is short form of (Berkeley Iinternet Name Domain) which is implementation of DNS on Linux Operating System. It is one of the most popular and open source DNS application used by ISP (Internet Service Providers) and also by the private networks.

  • RHEL7/CentOS7 offers BIND as their default DNS software.

In this giude we will configure Caching-Only DNS Server and later in next coming articles we will install Primary and Slave DNS Servers. So for now let’s install Caching-Only DNS Server on RHEL7/CentOs 7

If you are using CentOS 6.x, you should follow the below link.

Required steps to install Caching-Only DNS Server

  1. Install BIND Package
  2. Modify BIND configuration file (/etc/named.conf)
  3. Configure the SELinux context if enforcing mode
  4. Enable BIND service at system startup
  5. Start the BIND service
  6. Allow DNS service port 53 in firewall
  7. Testing from client side

Step 1: Install BIND packages

yum install bind bind-utils -y

Step 2: Modify BIND Configuration File (/etc/named.conf)

  • By default it works as a localhost DNS resolver only

Allow DNS to accept and answer client DNS queries from your local subnet edit named.conf file using Vi Text Editor and modify the following parameters according to your network settings.

listen-on port 53 { 127.0.0.1; any; };
allow-query     { localhost; any; };
allow-query-cache       { localhost; any; };

To verify configuration done in correct manners use the following command

named-checkconf

Step 3: Configure the SELinux context if enforcing mode

semanage fcontext -a -t named_conf_t /etc/named.conf
 semanage fcontext -a -t named_conf_t /etc/named.rfc1912.zones

Step 4: Enable BIND Service at System Startup

systemctl enable named.service

Step 5: Start BIND Service

systemctl start named.service

To check status

systemctl status named.status

Step 6: Allow DNS Port 53 in Linux Firewall

firewall-cmd --permanent --add-service=dns
firewall-cmd --reload

Step 7: Testing From Client Side

For testing purpose we have one windows 7 client machine in our network. Before you start testing, make sure client ip settings is pointing our local caching only dns server as primary dns.

  • In my test lab network DNS serve IP is: 192.168.2.100/24.

nslookoup www.broexperts.com
See result below:

How to Configure BIND On Linux CentOS
How to Configure DNS (BIND) on RHEL7/CentOS7

Similar Posts