DNS Server Setup
DNS Server Setup
cat /etc/*release
Disabling SELinux
Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for
supporting access control security policies, including mandatory access controls.
In RHEL, CentOS, AlmaLinux or several derivatives, the SELinux feature is enabled by default. But, some
applications may not actually support this security mechanism. Therefore, to make such applications
function normally, you have to disable or turn off SELinux.
firewall-cmd --get-active-zones
Now run the following commands for functioning the whole mailing system.
vi /etc/ssh/sshd_config
If, you find mismatched date or time, then need to adjust your time zone by running the below command.
Then, confirm that the change has been made with the timedatectl command.
cp /etc/named.conf /etc/named.conf.ori
Open the main configuration file named.conf and change to the following red marked parameters.
options {
listen-on port 53 { 103.157.135.170; };
listen-on-v6 port 53 { 2402:f500:3:2:250:56ff:fe81:89d2; };
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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { any; };
// recursion no;
allow-recursion {my_clients; };
dnssec-validation yes;
managed-keys-directory "/var/named/dynamic";
geoip-directory "/usr/share/GeoIP";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
include "/etc/crypto-policies/back-ends/bind.config";
};
acl my_clients {103.157.135.0/24; };
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";
-----------------------------------------------------------------------
Zone Configuration
Copy existing zone file for sample configuration with your given name in named.conf file like following:
cd /var/named/
cp named.localhost db.jamil.cloud
cp named.loopback db.135.157.103.in-addr.arpa
vi /var/named/db.jamil.cloud
cd /var/named/
chgrp named db.jamil.cloud
chgrp named db.135.157.103.in-addr.arpa
named-checkconf -z /etc/named.conf
ss -ulpn sport eq 53
Scenario
cat /etc/*release
Disabling SELinux
Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for
supporting access control security policies, including mandatory access controls.
In RHEL, CentOS, AlmaLinux or several derivatives, the SELinux feature is enabled by default. But, some
applications may not actually support this security mechanism. Therefore, to make such applications
function normally, you have to disable or turn off SELinux.
firewall-cmd --get-active-zones
Now run the following commands for functioning the whole mailing system.
vi /etc/ssh/sshd_config
If, you find mismatched date or time, then need to adjust your time zone by running the below command.
Then, confirm that the change has been made with the timedatectl command.
cp /etc/named.conf /etc/named.conf.ori
Open the main configuration file named.conf and change to the following red marked parameters.
options {
listen-on port 53 { 103.157.135.172; };
listen-on-v6 port 53 { 2402:f500:3:2:250:56ff:fe81:89d2; };
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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { any; };
// recursion no;
allow-recursion {my_clients; };
dnssec-validation yes;
managed-keys-directory "/var/named/dynamic";
geoip-directory "/usr/share/GeoIP";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
include "/etc/crypto-policies/back-ends/bind.config";
};
acl my_clients {103.157.135.0/24; };
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";
-----------------------------------------------------------------------
Configure Master/Primary DNS for this slave/Secondary DNS
Changed the file /etc/named.conf in in Primary DNS servers in only zone section like following:
Zone Configuration
In Secondary DNS, Zone files are contained in /var/named/slaves/ directory. We don’t need to create
zone files again, rather all zone files of Master DNS will be automatically transferred to this slave server.
Additionally, we need to specify this secondary DNS server as NS record like the following:
Testing Configuration and starting service
named-checkconf -z /etc/named.conf
ss -ulpn sport eq 53