How to create DNS server in linux

Introduction

Domain Name System (DNS) is a standard technology for managing public names of Web sites and other Internet domains. The Internet maintains two principal namespaces: the domain name hierarchy and the IP address system. The Domain Name System maintains the domain namespace and provides translation services between these two namespaces. Internet name servers implement the Domain Name System. The top hierarchy of the Domain Name System is served by the root name servers maintained by delegation by the Internet Corporation for Assigned Names and Numbers (ICANN). Below the root, Internet resources are organized into a hierarchy of domains, administered by the respective registrars and domain name holders. A DNS name server is a server that stores the DNS records, such as address (A, AAAA) records, name server (NS) records, and mail exchanger (MX) records for a domain name and responds with answers to queries against its database.

By Default Port # 53
Dns-query

Step 1: Installation

To create a DNS server, firstly we have to install the bind packages:

# yum -y install bind.* bind-utils
Loaded plugins: amazon-id, rhui-lb
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Processing Dependency: bind-libs = 32:9.9.4-18.el7_1.1 for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: liblwres.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisccfg.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisccc.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libisc.so.95()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libdns.so.100()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
--> Processing Dependency: libbind9.so.90()(64bit) for package: 32:bind-9.9.4-18.el7_1.1.x86_64
---> Package bind-utils.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Running transaction check
---> Package bind-libs.x86_64 32:9.9.4-18.el7_1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                       Arch                      Version                                   Repository                                           Size
=============================================================================================================================================================
Installing:
 bind                          x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    1.8 M
 bind-utils                    x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    199 k
Installing for dependencies:
 bind-libs                     x86_64                    32:9.9.4-18.el7_1.1                       rhui-REGION-rhel-server-releases                    1.0 M

Transaction Summary
=============================================================================================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 2.9 M
Installed size: 7.2 M
Downloading packages:
(1/3): bind-9.9.4-18.el7_1.1.x86_64.rpm                                                                                               | 1.8 MB  00:00:00
(2/3): bind-libs-9.9.4-18.el7_1.1.x86_64.rpm                                                                                          | 1.0 MB  00:00:00
(3/3): bind-utils-9.9.4-18.el7_1.1.x86_64.rpm                                                                                         | 199 kB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        5.0 MB/s | 2.9 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 32:bind-libs-9.9.4-18.el7_1.1.x86_64                                                                                                      1/3
  Installing : 32:bind-utils-9.9.4-18.el7_1.1.x86_64                                                                                                     2/3
  Installing : 32:bind-9.9.4-18.el7_1.1.x86_64                                                                                                           3/3
  Verifying  : 32:bind-utils-9.9.4-18.el7_1.1.x86_64                                                                                                     1/3
  Verifying  : 32:bind-libs-9.9.4-18.el7_1.1.x86_64                                                                                                      2/3
  Verifying  : 32:bind-9.9.4-18.el7_1.1.x86_64                                                                                                           3/3

Installed:
  bind.x86_64 32:9.9.4-18.el7_1.1                                            bind-utils.x86_64 32:9.9.4-18.el7_1.1

Dependency Installed:
  bind-libs.x86_64 32:9.9.4-18.el7_1.1

Complete!

Step 2: Configuration

Edit the file named.conf and make the changes:

# vi /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.0.100;};
allow-query     { localhost; 192.168.1.0/24; };     
# vi /etc/resolv.conf
server 192.168.0.100

To flush the DNS cache

# rnds flush
# vi /etc/named.rfc1912.zones
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *