This Article has not been finished yet.
Might contain errors and I might change it completely before finalizing it.
Developed in the 80’s by students at Berkeley University, BIND (Berkeley Internet Name Domain) is an open source DNS server that provides DNS services on Linux distributions.
A DNS server is a service that helps to resolve a fully qualified domain name (FQDN) such as google.com into an IP address like 142.250.185.14 and additionally, perform a reverse translation– translation of an IP address to a user-friendly domain name (FQDN).
Lab Setup:
You can use RHEL 8 through the Free Developer Subscription and register your virtual machine with subscription manager to get updates and access the repositories for installing software in this lab exercise or You can use AlmaLinux 8.3 which is a binary 1:1 RHEL 8 alternative for free no strings attached.
Server: AlmaLinux 8.3 – fqdn: masterdns.fruitgarden.local
Client: AlmaLinux 8.3 – fqdn: client01.fruitgarden.local
IP address Server: 172.18.1.2/24 (static ip) GW: 172.28.1.1
IP address Client: 172.18.1.55/24 ( static ip) GW: 172.28.1.1
Domain: fruitgarden.local

Our Client01 VM will use MasterDNS VM as its primary DNS resolver for DNS queries like whats the IP of google.com or which FQDN belongs to the IP address 72.163.4.185
The MasterDNS VM will also be the authoritative domain name server for the domain: fruitgarden.local.
A great article explaining authoritative vs recursive dns servers can be found on this link from cisco blog.
Step 0 – Prepare the Virtual Machines
This step will slightly be different for everyone.
To Sum it up You have to pick a virtualization platform of your choice ( can use a cloud provider like AWS or Azure or Google Cloud Platform if You prefer) and prepare the two virtual machines to match the below configuration:
I used VMWare Workstation 16.1 Professional on Fedora 33 with a Host-only network ( vmnet15) configured as below to provide the basic networking functionality (way-in way-out from the chosen subnet 172.18.1.0/24 to the outside world and it also provides DHCP services although We will set our MasterDNS and Client01 vms to use static IP in this lab exercises.
The DHCP server provided by VMWare Workstation will help to have network connectivity out of the box while we update and configure our static ip addresses and install our packages the very first time.


The same can be achieved with Virtualbox or KVM or any other virtualization platform of your choice.



Extra Troubleshooting Step for Me to make Networking working as a result that I have used Minimal ISO to install Almalinux 8.3 and It was a very Minimal installation indeed
( I guess its the same for RHEL 8 Minimal ISO installer as well )
Scenario:
I used the AlmaLinux-8.3-x86_64-minimal.iso to set up my two VMs MasterDNS.fruitgarden.local and Client01.fruitgarden.local
The out of the box installation landed me in the below situation:
+ I was able to ping my default gateway: 172.18.1.1 but nothing beyond that means no ping for 1.1.1.1 or google.com
After checking the basic config files and some troubleshooting I did I have realized I was missing the default route on the machine including the base package net-tools which provides the route command as well to add and modify routing table entries 🙂
Solution for this problem is perfectly outlined in the following article for RHEL 7.x which I had to modify only slightly for this to work for AlmaLinux 8.3
( # is the prompt designation for the root account)
1. Mount the Minimal ISO file of AlmaLinux I used for installing the system to a directory
# mkdir -p /mnt/disc
# mount /dev/sr0 /mnt/disc
2. Copy the media.repo
file from the root of the mounted directory to /etc/yum.repos.d/
and set the permissions to 0644
or another similar permissions set:
# cp /mnt/disc/media.repo /etc/yum.repos.d/almalinux8.3minimal.repo
# chmod 644 /etc/yum.repos.d/almalinux8.3minimal.repo
3. Edit the new repo file as below
vi /etc/yum.repos.d/almalinux8.3minimal.repo
[InstallMedia]
enabled=1
baseurl=file:///mnt/disc/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
name=AlmaLinux 8.3 Minimal ISO Local Repo
mediaid=None
metadata_expire=-1
gpgcheck=1
cost=500
4. Clear the cache and check whether you can get the packages list from the Local repo

5. Install net-tools from the configured Local Repository

6. Add Default route with the route add default gw X.X.X.X command
# route add default gw 172.18.1.1
7. Confirm default route with the route command

8. Confirming it all together

route > confirming default route exists
cat /etc/resolv.conf > confirming the nameserver (DNS Server) of Google’s added for name resolution
ping 1.1.1.1 > confirm network connectivity towards WAN *to external address on the internet*
ping google.com > confirms not just the network connectivity to the external world but also DNS name resolution ( through the set Google’s DNS 8.8.8.8 for no )
Result:
Ping beyond my Default Gateway 172.18.1.1 working for the Host
( MasterDNS and Client01 both fixed the same way for now)
+ Also DNS name resolution did not work Out of the box as the the AlmaLinux 8.3 Minimal ISO installer set my nameserver to 172.18.1.1 which is my default GW for the subnet I configured however that IP is not configured to provide DNS Services.
Further looking into this issue there were two solutions to the DNS resolution problem:
- I could add as a temporary measure Google’s DNS resolver for example to my /etc/resolv.conf file until I get to the steps to setup DNS resolution on MasterDNS.fruitgarden.local to handle DNS name resolution for Client01.fruitgarden.local and also for itself (MasterDNS VM) —> I chose this option for now

Result:
DNS Resolution working temporarily for the Host
( MasterDNS and Client01 both fixed the same way for now)
- On Windows Hosts there is a possibility to change the DHCP Server parameters offered by VMWare Workstation Pro to Your Configured Subnet meaning You can add for Example Google’s resolver 8.8.8.8 to be handed out with the IP addresses instead of the Default GW: 172.18.1.1 in my case
I found that while under Linux there is no GUI way to tune these parameters It looks like You can edit the dhcp.conf file respective to Your VMNET You have created found at the location:
For any of the host-only networks: /etc/vmware/vmnetXX/dhcp/dhcp.conf

For the NAT network: /etc/vmware/vmnet8/dhcp/dhcp.conf
How to Set Up DNS Server (BIND) Under AlmaLinux 8.3 / RHEL
Step 1. Installation of the bind and bind-utils package. These packages constitutes dns server and its utilities responsible for querying name servers or DNS servers

Step 2. Configure Bind DNS Server


Also amend the allow-query line and include the network/s from which You allow queries to come from. In my case as both MasterDNS and Client01 will be in the 172.28.1.0/24 network I have added that after the localhost entry.


Step 3. Create a Forward DNS zone file for the domain
Create a forward DNS zone file for domain fruitgarden.local as shown below at /var/named/fruitgarden.local.db and add the following content
(( In Part II. We will add a Secondary (Slave) DNS Server with IP 172.18.1.3 as well to this setup which will replicate everything from the MasterDNS Server ))
$TTL 86400
@ IN SOA masterdns.fruitgarden.local. root.fruitgarden.local. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS masterdns.fruitgarden.local.
@ IN NS secondarydns.fruitgarden.local.
masterdns IN A 172.18.1.2
secondarydns IN A 172.18.1.3
client01 IN A 172.18.1.55
Step 4. Create a Reverse DNS zone file for the domain
Create a reverse DNS zone file for the domain fruitgarden.local as shown below at /var/named/fruitgarden.local.rev and add the following content
(( In Part II. We will add a Secondary (Slave) DNS Server with IP 172.18.1.3 as well to this setup which will replicate everything from the MasterDNS Server ))
$TTL 86400
@ IN SOA masterdns.fruitgarden.local. root.fruitgarden.local. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS masterdns.fruitgarden.local.
@ IN NS secondarydns.fruitgarden.local.
@ IN PTR fruitgarden.local.
masterdns IN A 172.18.1.2
secondarydns IN A 172.18.1.3
client01 IN A 172.18.1.55
2 IN PTR masterdns.fruitgarden.local.
3 IN PTR secondarydns.fruitgarden.local.
55 IN PTR client01.fruitgarden.local.
Step 5. Assign the necessary ownership to the forward and reverse DNS files created FIX SCREENSHOT AND FILENAMES
# chown named:named /var/named/forward.fruitgarden
# chown named:named /var/named/reverse.fruitgarden

Step 6. Check named configuration file and the forward and reverse DNS zone files for syntax errors FIX SCREENSHOT AND FILENAMES
# named-checkconf
# named-checkzone fruitgarden.local /var/named/forward.fruitgarden
# named-checkzone fruitgarden.local /var/named/reverse.fruitgarden

Step 7. Set Static IP address for MasterDNS.fruitgarden.local and Client01.fruitgarden.local
Confirm our Network Interface Card’s name and its actual configuration
# ip a
# cat /etc/sysconfig/network-scripts/ifcfg-%INTERFACENAME%

It is set to DHCP right now therefore I need to change that and set a static IP address which I have previously preselected 172.18.1.2/24 with Gateway:172.18.1.1 and for DNS: 172.18.1.2
Change the content of Your Network Interface card configuration to match the below (highlighted the changes)
# vi /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="ens160"
UUID=530995f8-f347-437e-a8a1-7df07f14eb01
DEVICE=ens160
ONBOOT=yes
IPADDR=172.18.1.2
PREFIX=24
GATEWAY=172.18.1.1
DNS1=172.18.1.2
To apply the new IP address and the changes made in the network configuration file for the interface the quickest way for me is:
Deactivate and Activate the Interface from nmtui from terminal
( interacting with the Virtual Machine via VMware Workstation Pro for this step therefore Deactivating/Activating the interface will not affect the connectivity. If you were to connect via ssh when you deactivate the network interface You will loose network connectivity)
( if you are connected over ssh then perhaps its easier just to issue reboot command and let the server be brought back up with the new IP address )
nmtui main menu after running nmtui from terminal
Choose Activate a connection menuIf we had various network interfaces they’d all show up here ( except loopback)
the * marks activated/active connection
Choose Deactivate and Activate again on your corresponding network interface to apply the settings modified in the interface’s network configuration fileYou can use the ip a command to confirm that the network interface indeed using the new statically assigned IP address It is useful to confirm that the DNS server address configured in the network interface’s configuration file has been correctly modified/applied in /etc/resolv.conf
Repeat the steps above to change the settings for Client01.fruitgarden.local ::
IP: 172.18.1.55/24
Gateway: 172.18.1.1
DNS1: 172.18.1.2
Step 8. Enable and Start Bind DNS Service on MasterDNS.fruitgarden.local
Tests from client end
