Chitika

Tuesday, October 13, 2015

How to setup DNS server on RedHat Enterprise Server 7

In this How-To we are going to setup DNS server for a single zone for our test domain mydomain.local. This DNS server will act as master authority for this domain and will resolve fully qualified domain name (FQDN) mydomain.local and www.mydomain.local to IP address 20.0.0.3.

Our Named Daemon will listen on two local IP addresses, Loopback 127.0.0.1 and Interface IP address 20.0.0.3

 DNS Server Installation

To install DNS server Open Terminal and Run following Command

# yum -y install bind bind-utils

Once the DNS installtation finished we have to configure to named daemon to listen on loopback and local interface address. Open /etc/named.conf and change the following line as per your network configuration.


Check if hostname is correct. open vi /etc/hosts and it will looks like following.


Here now we can start named Daemon.


Now check if name dc can be resolved.


Now Check port 53 by netstat command. We have DNS server configured to listen on Loopback and local interface.


Now open firewall to allow DNS queries from external sources.


Creating Zones

The following is the forward zone entry in named.conf file, written for mydomain.local domain. Edit /etc/named.conf.


zone "mydomain.local" IN {
type master;
file "fwd.mydomain.local.db";
allow-update { none; };

};

The following is the reverse zone entry in the named.conf file.

zone "0.0.20.in-addr.arpa" IN {
type master;
file "0.0.20.db";
allow-update { none; };

};

Zone Configuration

Default location of zone file is /var/named. Run following command in terminal to create forward zone file.

#vi /var/named/fwd.mydomain.local.db

Edit as per your configurations.


Run following command to create reverse zone file.

# vi /var/named/0.0.20.db


Restart the BIND service.

# systemctl restart named.service

Enable it on system start up.

# systemctl enable named.service

Now go to a client machine and enter DNS Address 20.0.0.3. Ping dc.mydomain.local or ping www.mydomain.local



You can also verify the forward lookup zone by following command. 



We have successfully installed BIND on RHEL7 as Master server.

Cheers :-)

No comments:

Post a Comment