Install and configure BIND

Install BIND to configure DNS server which resolves domain name or IP address.

[1] Install BIND.

[[email protected] ~]# dnf install bind bind-utils -y

[2] Configure BIND.

[[email protected] ~]# vi /etc/named.conf

options {
        listen-on port    53    { any; };     # change ( listen all )
        listen-on-v6 port 53    { any; };     # change ( listen all )

        directory               "/var/named";
        dump-file               "/var/named/data/cache_dump.db";
        secroots-file           "/var/named/data/named.secroots";
        recursing-file          "/var/named/data/named.recursing";
        statistics-file         "/var/named/data/named_stats.txt";
        memstatistics-file      "/var/named/data/named_mem_stats.txt";

        allow-query             { any; };
        allow-transfer          { none; };
...

[3] Create the following files.

[[email protected] ~]# touch /var/named/data/cache_dump.db
[[email protected] ~]# touch /var/named/data/named.secroots
[[email protected] ~]# touch /var/named/data/named.recursing
[[email protected] ~]# touch /var/named/data/named_stats.txt
[[email protected] ~]# touch /var/named/data/named_mem_stats.txt

[4] Set directory and file permissions.

[[email protected] ~]# chown named:named -R /var/named
[[email protected] ~]# chown named:named -R /run/named

[5] If SELinux is active, set up SELinux policies.

[[email protected] ~]# restorecon -R /var/named
[[email protected] ~]# restorecon -R /run/named

[6] Add the named service to startup services and start the service.

[[email protected] ~]# systemctl enable named
[[email protected] ~]# systemctl start named

[7] If firewalld is active, allow dns service.

[[email protected] ~]# firewall-cmd --permanent --add-service=dns
success
[[email protected] ~]# firewall-cmd --reload
success