Setting Up DNS Server On CentOS 7

Use the command yum install bind bind-utils to install the necessary DNS server packages on CentOS 7.

Install the Bind Package

Edit the /etc/named.conf file to define your DNS zones, including forward and reverse lookup zones.

Configure the DNS Zone Files

Create the forward and reverse lookup zone files in the /var/named/ directory. Use templates for the zone files, such as db.example.com.

Create Zone Files

Ensure the correct ownership and permissions for the zone files by setting them to named:named using the chown command.

Set File Permissions

Start the DNS server using systemctl start named and enable it to start on boot with systemctl enable named.

Start and Enable the DNS Service

Use the command firewall-cmd --permanent --add-service=dns and firewall-cmd --reload to allow DNS traffic through the firewall.

Open Firewall for DNS

Use the dig or nslookup commands to test and verify that your DNS server is working correctly by resolving domain names.

Test DNS Configuration