DOMAIN NAME SYSTEM (DNS)

Berkeley Internet Name Domain (BIND) is an open source software that implements the Domain Name System (DNS) service for the Internet which provides ability to perform hostname to IP address conversion.
The name BIND stands for “Berkeley Internet Name Domain”, because the software was developed in the early 1980s at the University of California at Berkeley.


DNS Prerequisite settings

Server Name : linux1.example.com
IP Address : 192.168.1.100
Default Gateway: 192.168.1.1
DNS Addresses : 192.168.1.100, 8.8.8.8


Set hostname on Linux Server


[root@localhost~]#vi /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.1.100 linux1.example.com
      

Install BIND 9 RPMs on Linux Server


[root@linux1~]#yum install bind bind-utils –y

Edit DNS file using vi editor


                                    
[root@linux1~]#  vi /etc/named.conf 
// See /usr/share/doc/bind*/
//
 acl my-host { 192.168.1.100; }; 
 acl my-net { 192.168.1.0/24; };
options {
    listen-on port 53 { 127.0.0.1;  my-host;  };
    listen-on-v6 port 53 { ::1; };
    directory "/var/named";
    dump-file "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    secroots-file “/var/named/data/named.secroots”;
    recursing-file “/var/named/data/named.recursing”;
    allow-query { localhost;  my-net;  };
.
.
.
include "/etc/named.root.key";
 zone "example.com" IN {
    type master;
    file "/var/named/example.fw.db";
    allow-update { none; };
}; 
      

Create a Forward lookup zone file as below


#cd /var/named/
#cp named.localhost example.fw.db
#vi example.fw.db
      

#chgrp named /var/named/example.fw.db
#chmod 777 /var/named/example.fw.db
      

Check the configuration


#named-checkconf /etc/named.conf
#named-checkzone example.com
/var/named/example.fw.db
Zone example.com/IN: loaded serial 0
Ok
      

Firewall configuration to add allow rule


# firewall-cmd --permanent --add-port=53/udp
# firewall-cmd –reload
      

Start the services


[root@linux1~]#systemctl restart named
[root@linux1~]#systemctl enable named
[root@linux1~]#systemctl status named     

Edit DNS Resolver file like

Check forward lookup configuration

Verify DNS Resolution using ping command