Menu Close
Settings Close

Language and Page Formatting Options

Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 4. Configuring and managing a BIND DNS server

DNS (Domain Name System) is a distributed database system that associates hostnames with their respective IP addresses. BIND (Berkeley Internet Name Domain) consists of a set of DNS-related programs. It contains a name server called named. The /etc/named.conf is the main configuration file in the BIND configuration. This section focuses on installing, configuring, and managing BIND on the DNS server.

4.1. Installing BIND

The installation of the bind-utils package ensures the BIND utilities are available on the system.


  1. Install BIND:

    # yum install bind bind-utils
  2. Enable and start the named service:

    # systemctl enable --now named

Verification steps

  • Verify the status of the named service:

    # systemctl status named

4.2. Configuring BIND as a caching name server

The following procedure demonstrates configuring BIND as a caching name server.


  • The bind package is installed.


  1. Ensure to take backup of the original configuration file.

    # cp /etc/named.conf /etc/named.conf.orig
  2. Edit the /etc/named.conf file with the following changes:

    • In the options section, uncomment the listen-on, listen-on-v6, and directory parameters:

      acl clients {;};
      options {
              listen-on port 53 { any; };
              listen-on-v6 port 53 { any; };
              directory       "/var/named";
    • Set the allow-query parameter to your network address. Only the hosts on your local network can query the DNS server:

          allow-query     { localhost; clients; };
          allow-recursion { localhost; clients; };
          recursion yes;
          allow-update { none; };
          allow-transfer { localhost; };
      logging {
              channel default_debug {
                      file "data/";
                      severity dynamic;
    • Use the package shipped file as:

      include "/etc/named.rfc1912.zones";
    • Create an extra include for any custom zone configuration:

      include "/etc/named/example.zones";
  3. Create the /etc/named/example.zones file and add the following zone configuration:

    //forward zone
    zone "" IN {
            type master;
            file "";
    //backward zone
    zone "" IN {
            type master;
            file "";
    • type: It defines the zone’s role of the server.
    • master: It is an authoritative server and maintains the master copy of the zone data.
    • file: It specifies the zone’s database file.
  4. Go to DNS data directory /var/named/:

    # cd /var/named/
    # ls
    data    dynamic  named.empty    named.localhost    named.loopback  slaves
  5. Create the /var/named/ file with your forward zone parameters:

    $TTL    86400
    @	IN	SOA	root (
    		42         ; serial
    		3H         ; refresh
    		15M        ; retry
    		1W         ; expiry
    		1D )       ; minimum
    	IN	NS
    ns              IN A  
    station1        IN A  
    station2        IN A  
    station3        IN A  
  6. Create the /var/named/ file with your reverse zone parameters:

    $TTL    86400
    @	IN	SOA (
    		1997022700 ; serial
    		28800      ; refresh
    		14400      ; retry
    		3600000    ; expire
    		86400 )    ; minimum
    	IN	NS
    101     IN      PTR
    102     IN      PTR
    103     IN      PTR
  7. Set secure permissions on the zone files:

    # chown root:named /var/named/ /var/named/
    # chmod 640 /var/named/ /var/named/
  8. Restart BIND:

    # systemctl restart named

Verification steps

  • Verify the forward zone file:

    # named-checkzone /var/named/
    zone loaded serial xxxxxxx
  • Verify the reverse zone file:

    # named-checkzone /var/named/
    zone loaded serial xxxxxxx
  • Verify the configuration:

    # named-checkconf /etc/named.conf

    If the configuration is correct, the command does not return any output.