Setting up DNS Server

We will now setup our BIND DNS server. DNS is used to translate IP Address to fully qualified domain names. We also need DNS for mail management through MX records.

  • Install BIND

    yum -y install bind bind-utils

  • Edit /etc/named/named.conf

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
	listen-on port 53 { any; };
	listen-on-v6 port 53 { ::1; };
	directory 	"/var/named";
	dump-file 	"/var/named/data/cache_dump.db";
	statistics-file "/var/named/data/named_stats.txt";
	memstatistics-file "/var/named/data/named_mem_stats.txt";
	allow-query     { any; };
	recursion yes;
	dnssec-enable no;
	dnssec-validation no;
	dnssec-lookaside auto;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.iscdlv.key";

	managed-keys-directory "/var/named/dynamic";

	pid-file "/run/named/named.pid";
	session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

## Internal zone definitions

zone "gracie.net" {
        type master;
        file "db.gracie.net";
	allow-update { none; };
};

zone "88.168.192.in-addr.arpa" {
        type master;
        file "db.88.168.192";
	allow-update { none; };
};
  • Create /var/named/db.gracie.net
$TTL    86400

@               IN      SOA     localhost. root.localhost. (
                                    2015101000    ; Serial
                                    86400         ; Refresh
                                    3600          ; Retry
                                    604800        ; Expire
                                    7200 )        ; Negative Cache TTL

@               IN      NS      localhost.

@               IN      A       192.168.88.10
dhcp            IN      A       192.168.88.10
dns             IN      A       192.168.88.10
mariadb         IN      A       192.168.88.11
  • Create /var/named/db.88.168.192
$TTL    86400

@               IN      SOA     localhost. root.localhost. (
                                    2015101000    ; Serial
                                    86400         ; Refresh
                                    3600          ; Retry
                                    604800        ; Expire
                                    7200 )        ; Negative Cache TTL

@               IN      NS      localhost.

2               IN      PTR     dhcp.gracie.net.    ;192.168.88.10
2               IN      PTR     dns.gracie.net.     ;192.168.88.10
2               IN      PTR     mariadb.gracie.net. ;192.168.88.11
  • Verify BIND configuration. Make sure no errors come up.

    named-checkconf /etc/named.conf

  • Start named service

    systemctl start named

  • Enable named on boot

    systemctl enable named

Written on November 19, 2015