First of all, install the RPM :

[root@fedora22 ~]# dnf -y install bind bind-utils

Right now, the DNS server is not running :

[root@fedora22 ~]# systemctl list-unit-files | grep named
 named-setup-rndc.service static
 named.service disabled
 systemd-hostnamed.service static
 [root@fedora22 ~]# systemctl status named-setup-rndc.service named.service systemd-hostnamed.service
 ● named-setup-rndc.service - Generate rndc key for BIND (DNS)
  Loaded: loaded (/usr/lib/systemd/system/named-setup-rndc.service; static; vendor preset: disabled)
  Active: inactive (dead)
● named.service - Berkeley Internet Name Domain (DNS)
  Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled)
  Active: inactive (dead)
● systemd-hostnamed.service - Hostname Service
  Loaded: loaded (/usr/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: disabled)
  Active: inactive (dead)
  Docs: man:systemd-hostnamed.service(8)
  man:hostname(5)
  man:machine-info(5)
  http://www.freedesktop.org/wiki/Software/systemd/hostnamed

“rndc” utility configuration

This command line tool will allow you to manage your DNS (named) server

Create configuration files once :

[root@fedora22 ~]# rndc-confgen
 # Start of rndc.conf
 key "rndc-key" {
  algorithm hmac-md5;
  secret "Na9XUsYTyZVCkjCZEQAHqw==";
 };
 options {
  default-key "rndc-key";
  default-server 127.0.0.1;
  default-port 953;
 };
 # End of rndc.conf
 # Use with the following in named.conf, adjusting the allow list as needed:
 # key "rndc-key" {
 # algorithm hmac-md5;
 # secret "Na9XUsYTyZVCkjCZEQAHqw==";
 # };
 #
 # controls {
 # inet 127.0.0.1 port 953
 # allow { 127.0.0.1; } keys { "rndc-key"; };
 # };
 # End of named.conf

Add entries in “/etc/named.conf” :

// following lines comming from "rndc-confgen" utility :
 key "rndc-key" {
  algorithm hmac-md5;
  secret "Na9XUsYTyZVCkjCZEQAHqw==";
 };
 controls {
  inet 127.0.0.1 port 953
  allow { 127.0.0.1; 192.168.1.0/24; } keys { "rndc-key"; };
 };

And create “/etc/rndc.conf” file :

[root@fedora22 ~]# cat /etc/rndc.conf
 key "rndc-key" {
  algorithm hmac-md5;
  secret "Na9XUsYTyZVCkjCZEQAHqw==";
 };
 options {
  default-key "rndc-key";
  default-server 127.0.0.1;
  default-port 953;
 };

Change rights (write  & read for “root” only) :

[root@fedora22 ~]# chmod u=rw,go= /etc/rndc.conf

Start the service :

[root@fedora22 ~]# systemctl start named.service

And check “rndc” :

[root@fedora22 ~]# rndc status
 version: 9.10.2-P4-RedHat-9.10.2-5.P4.fc22 <id:2754d37>
 boot time: Tue, 06 Oct 2015 13:32:53 GMT
 last configured: Tue, 06 Oct 2015 13:32:53 GMT
 CPUs found: 1
 worker threads: 1
 UDP listeners per interface: 1
 number of zones: 101
 debug level: 0
 xfers running: 0
 xfers deferred: 0
 soa queries in progress: 0
 query logging is OFF
 recursive clients: 0/0/1000
 tcp clients: 0/100
 server is up and running

OK, “rndc” and “named” can work together… On port 953/tcp :

[root@fedora22 ~]# netstat -tulpn | grep 953
 tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1847/named
[root@fedora22 ~]# ps -ef | egrep "named *1847"
 named 1847 1 0 15:55 ? 00:00:00 /usr/sbin/named -u named

or :

[root@fedora22 ~]# lsof -i tcp:953
 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
 named 1847 named 23u IPv4 46266 0t0 TCP localhost:rndc (LISTEN)

Now, stop the service in order to continue the configuration :

[root@fedora22 ~]# systemctl stop named.service

named service

We would like to have “named” started each reboot

Currently, “named” will not start next reboot :

[root@fedora22 ~]# systemctl is-enabled named.service
disabled

To enable “named” service :

[root@fedora22 ~]# systemctl enable named.service
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.

And after reboot, 

[root@fedora22 ~]# uptime
 10:11:07 up 0 min, 1 user, load average: 1.16, 0.35, 0.12

The service is up and running :

[root@fedora22 ~]# systemctl is-enabled named.service
enabled
[root@fedora22 ~]# rndc reload
server reload successful

DNS configuration

Change some options in “/etc/named.conf” file :

// listen-on port 53 { 127.0.0.1; };
  listen-on port 53 { any; };
 // listen-on-v6 port 53 { ::1; };
  listen-on-v6 port 53 { none; };
 // allow-query { localhost; };
  allow-query { any; };

Create a new zone (I named mine “argonay.wou”) in “/etc/named.conf” file :

// my zone as follows
  zone "argonay.wou" IN {
  type master;
  file "argonay.wou.db";
  allow-update { none; };
 };

Create the zone file “/var/named/argonay.wou.d” :

[root@fedora22 ~]# cat /var/named/argonay.wou.db
$TTL 3D
@               IN      SOA argonay.wou. root.argonay.wou. (
                                   2015100601 ; Serial
                                   28800 ; Refresh
                                   7200 ; Retry
                                   604800 ; Expire
                                   86400) ; Minimum TTL
                NS      fedora22.argonay.wou.

fedora22        A       192.168.1.203

Where “fedora22” is my DNS server (i.P. address : 192.168.1.203)

Start the DNS server :

[root@fedora22 ~]# systemctl start named.service

Now, we’ll use webmin to manage zones and records …

 

 

 

 

 

tools.pdf24.org    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*