Domain Name System (DNS) is the service which helps to resolve a fully qualified domain name (FQDN) into an IP address and a reverse translation of an IP Address to user friendly domain name. All Linux distributions are using BIND (Berkeley Internet Name Domain) which was developed by a student of Berkeley University in the 80’s.
- Primary DNS Server: CentOS 8
- Host Name: dns1.sysnet-admin.com
- Address: 192.168.200.200
- Domain: sysnet-admin.com
- Secondary DNS Server: CentOS 8
- Host Name: dns2.sysnet-admin.com
- Address: 192.168.200.201
- Domain: sysnet-admin.com
- Client: CentOS 8
- IP Address: 192.168.200.250
- Host Name: cent-client.sysnet-admin.com
I. Primary DNS Server using BIND
2. Start DNS service named and make sure the service status is running.
2. Edit the configuration file with the command vi /etc/named.conf
3. Create an ACL(similar to variable) to represent internal network.
4. Comment out the lines below for both IPv4 and IPv6 to avoid DNS server listening from all IP addresses and we will only instruct this DNS server only to list the query from our local network.
6. Let change directory to /var/named and you can see all default DNS zone files here.
7. Let create a zone file named sysnet-admin.com.db for our Forward Lookup Zone
8. Add the following content to this Forward Lookup zone file and save.
9. Create another zone file named 192.168.200.db for our Reverse Lookup Zone
10. Add the following content to this Reverse Lookup zone file and save.
11. Set permission for BIND user (named) and group (named) as the owner of both zone files
12. Use the following command to check the configuration files to make sure our set are working fine
13. Enable BIND DNS service (named) to automatically startup at system boot.
14. Allow the inbound traffic in the firewall for DNS service and reload the firewall service
Verification from Client Machine
2. Set the primary DNS server to the DNS server IP address and save the confirguration
3. Restart Network Manager service to apply new DNS setting change
4. Now let try to verify the DNS service by using the command nslookup from the client machine and we can see that our DNS server can translate from domain name to IP address, this means our Forward Lookup is working fine.
5. Following result also shows that our DNS server can translate from IP addresses to domain names, this means the Reverse Lookup zone also working fine.
This is how we configure DNS server on CentOS 8 for the organization.
II. Secondary DNS Server Using BIND
BIND Installation & Configuration
1. Install the BIND package
2. Go to edit BIND configuration file at /etc/named.conf
3. Specify ACL for local subnet and instruct this DNS server only to list the query from our local network.
4. Configure Forward and Reverse Lookup zones. Now note that the type of this server is Slave which mean it is secondary DNS server and it will sync the zone files from master (primary) server. Add following configuration to the bottom of named.conf file and save.
6. Now let start the DNS service and make it permanently start at system boot.
7. Once the service is started, the secondary DNS server should sync the 2 zone files from Primary DNS server. Both files are stored in this path /var/named/slaves
8. Make sure we configure both DNS server IP addresses (Primary and Secondary) on this server.
9. Let test the DNS translation and now we can see primary DNS server is translasting from domain name to IP address and from IP address to domain name since the Server is 192.168.200.200.
10. Now let make sure that our secondary DNS also can do the name resolution. Go to edit the network interface at /etc/sysconfig/network-script/ifcfg-eth0 and comment out (disable) the DNS1 so that only DNS2 is going to work.
11. Restart the Network Manager service so that our network configuration changes takes effect.
12. Now secondary (Server: 192.168.200.201) is working and translating from domain name to IP address and vice versa.