How To Configure BIND as a Private Network DNS Server on CentOS 7

How To Configure BIND as a Private Network DNS Server on CentOS 7

How To Configure BIND as a Private Network DNS Server on CentOS 7

BIND, or Berkeley Internet Name Domain, is a widely used DNS server software. In this tutorial, we will walk through the steps to configure BIND as a private network DNS server on CentOS 7.

Step 1: Install BIND

First, we need to install BIND on our CentOS 7 server:

      sudo yum install bind bind-utils
    

Step 2: Configure BIND

Next, we need to configure BIND to act as a private network DNS server. Open the main configuration file for BIND:

      sudo nano /etc/named.conf
    

Inside the "options" section of the file, add the following lines:

      listen-on port 53 { any; };
      allow-query { localhost; 192.168.0.0/24; };
      recursion yes;
    

The first line specifies that BIND should listen on port 53 for incoming DNS requests. The "any" keyword means that BIND should listen on all available network interfaces. If you want to limit BIND to a specific network interface, replace "any" with the IP address of the interface.

The second line specifies that BIND should allow DNS queries from the localhost and the 192.168.0.0/24 network. If your private network uses a different IP address range, replace "192.168.0.0/24" with the appropriate subnet mask.

The third line enables recursive DNS queries, which means that BIND will try to resolve DNS queries that it doesn't have the answer to by asking other DNS servers on the Internet.

Save and close the file.

Step 3: Create DNS Zones

Now we need to create DNS zones for our private network. Open the BIND configuration file for our DNS zones:

      sudo nano /etc/named.conf.local
    

Add the following lines to create a forward lookup zone for the "example.com" domain:

      zone "example.com" IN {
          type master;
          file "/etc/named/zones/example.com.db";
      };
    

The "type master" line specifies that BIND should be the authoritative server for this zone. The "file" line specifies the location of the zone data file.

Create the directory for the zone data file:

      sudo mkdir /etc/named/zones
    

Create the zone data file:

      sudo nano /etc/named/zones/example.com.db
    

Add the following lines to the zone data file:

      $TTL 86400
      @ IN SOA ns1.example.com. root.example.com. (
          1 ; Serial
          3600 ; Refresh
          1800 ; Retry
          604800 ; Expire
          864

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS