23.9 C
Texas

setup DNS Server with Rocky Linux

Rocky Linux is an RHEL derivative. As the life of CentOS is cut short to Dec 2021. Rocky Linux gonna be downstream. Enterprises looking for CentOS alternatives, for sure can rely on that OS. Though, Rocky Linux is an exact replica of CentOS. But, we will publish all popular services tutorials for Rocky Linux. Today we will see how to set up DNS (BIND Server) with Rocky Linux. Let’s go step by step.

Prerequisites

In our scenario following will be basic settings:

Disk capacity: 30 G

RAM: 2 G

- Advertisement -

Domain Name: wwww.rajdemo.com

Server IP Address: 172.16.10.222

Forwarder zone file name: forward.rajdemo.com

Reverse Zone file name : reverse.rajdemo.com

Configuration of DNS Server

Check IP address of Server first.

Change hostname for server. Edit /etc/hostname file

# echo /etc/hostname 

To run dns service, lets install required packaged.

# yum install bind bind-utils -y

First, configure /etc/named.conf file. Here, in this file we require to define acls. forward and reverse zone files also indicated in the same file. Lets have a look.

Define ACLs, Bind services work batter if acl is defined for desired network.

Provide your Server IP address details on listening port i.e. port 53.

Enable allow-query as allowed.

Denote where your forward zone file will be.

zone "forward.rajdemo.com" IN {
type master;
file "/var/named/forward.rajdemo.com";
allow-update { none; };
};

Lets BIND know where will be your reverse zone file.

zone "10.16.172.in-addr.arpa" IN {
type master;
file "/var/named/reverse.rajdemo.com";
allow-update { none; };
};

Have a final look on conf file.

Configure Forward zone file first.

# vim /var/named/forward.rajdemo.com

Amend configuration settings as below.

$TTL 86400
@ IN SOA www.rajdemo.com. admin.rajdemo.com. (
2021062301 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ) ; minimum TTL
;
; nameservers
IN NS www.rajdemo.com.
;
; DNS Server IP addresses and hostnames
@ IN A 172.16.10.222

Similarly, amend the reverse zone configuration file as well. Make sure to change settings as per your requirements. In reverse configuration files don’t forget to point IP address as PTR record.

#vim /var/named/reverse.rajdemo.com
$TTL 86400
@ IN SOA www.rajdemo.com. admin.rajdemo.com. (
2021062302 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ) ; minimum TTL
;
;nameservers
IN NS www.rajdemo.com.
;
;nameserver IP addresses
IN A 172.16.10.222
;
; nameserver PTR records
222 IN PTR www.rajdemo.com.
;

Now, all of our configuration settings are up to the mark. Time to test our settings. First of all, we will run a configuration check utility. If all configurations as tunes, this command will show no output. Let’s try.

 # named-checkconf  

Lets check all our zone files one by one, check forward zone file first.

#named-checkzone www.rajdemo.com /var/named/forward.rajdemo.com

Check reverse zone, if that’s working fine or not.

#named-checkzone 10.16.172.in-addr.arpa /var/named/reverse.rajdemo.com

Output

All configurations, seems good to go. Enable bind service on firewall.

systemctl enable --now named
firewall-cmd --add-service=dns --permanent

Conclusion

You can expect more articles based on Rocky Linux. We will cover all possible services soon.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article