Begin by disalbing SELinux and the firewall on both servers, then install BIND:
# On primary (192.168.32.168)
setenforce 0
systemctl stop firewalld
yum install bind -y
# On secondary (192.168.32.169)
setenforce 0
systemctl stop firewalld # corrected typo from 'filewalld'
yum install bind -y
Configure static IP addresses using nmcli:
# Primary
nmcli c modify ens33 ipv4.method manual \
ipv4.addresses '192.168.32.168/24' \
ipv4.gateway '192.168.32.2' \
ipv4.dns '192.168.32.168'
nmcli c reload && nmcli c up ens33
# Secondary
nmcli c modify ens33 ipv4.method manual \
ipv4.addresses '192.168.32.169/24' \
ipv4.gateway '192.168.32.2' \
ipv4.dns '192.168.32.169'
nmcli c reload && nmcli c up ens33
On the primary server, edit /etc/named.conf to allow queries and zone transfers. In /etc/named.rfc1912.zones, define forward and reverse zones with allow-transfer { 192.168.32.169; };.
Create zone files in /var/named/:
cd /var/named
cp -a named.localhost openlab.com.zone
cp -a named.loopback 192.168.32.arpa
Populate openlab.com.zone for forward lookups (e.g., www IN A 192.168.32.168) and 192.168.32.arpa for reverse mapppings (e.g., 168 IN PTR www.openlab.com.). Ensure proper ownership (chown named:named *.zone *.arpa). Restart BIND:
systemctl restart named
On the secondary server, configure /etc/named.conf to listen on its IP. In /etc/named.rfc1912.zones, declare slave zones pointing to the primary:
zone "openlab.com" {
type slave;
file "slaves/openlab.com.zone";
masters { 192.168.32.168; };
};
zone "32.168.192.in-addr.arpa" {
type slave;
file "slaves/192.168.32.arpa";
masters { 192.168.32.168; };
};
Start BIND on the secondary:
systemctl start named
Verify synchronization by checking /var/named/slaves/ for transferred zone files. Test resolutino locally:
nslookup www.openlab.com 192.168.32.169
nslookup 192.168.32.168 192.168.32.169
dig @192.168.32.168 www.openlab.com