How to install caching only dns server on Rhel 8 / Centos 8
How to install caching only DNS server in RedHat 8 / Centos 8
- package name = bind
- service name = named
- port number = 53
- rndc port = 953
rndc it uses only the loopback address, rndc is used
to manage the name server.
to manage the name server.
Yum install bind bind-utils -y
Cp -p /etc/named.conf
/etc/named.conf.orig
/etc/named.conf.orig
rpm -qi bind
rpm -ql bind
Now configure dns server open the file “vim /etc/named.conf” and make changes:
[root@itsummation ~]# vim /etc/named.conf
//
options {
listen-on port 53 { localhost ; 192.168.56.12; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file
"/var/named/data/cache_dump.db";
"/var/named/data/cache_dump.db";
statistics-file
"/var/named/data/named_stats.txt";
"/var/named/data/named_stats.txt";
memstatistics-file
"/var/named/data/named_mem_stats.txt";
"/var/named/data/named_mem_stats.txt";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query {
localhost ; 192.168.56.0/24; };
/*
- If you are building an AUTHORITATIVE
DNS server, do NOT enable recursion.
DNS server, do NOT enable recursion.
- If you are building a RECURSIVE
(caching) DNS server, you need to enable
(caching) DNS server, you need to enable
recursion
- If your recursive DNS server has a
public IP address, you MUST enable access
public IP address, you MUST enable access
control to limit queries to your
legitimate users. Failing to do so will
legitimate users. Failing to do so will
cause your server to become part of large-scale
DNS amplification
DNS amplification
attacks. Implementing BCP38 within
your network would greatly
your network would greatly
reduce such attack surface */
recursion yes; << allow recursion yes please do not
set it to NO
set it to NO
dnssec-enable yes;
dnssec-validation yes;
managed-keys-directory
"/var/named/dynamic";
"/var/named/dynamic";
pid-file
"/run/named/named.pid";
"/run/named/named.pid";
: wq! Save exit
# named-checkconf
[root@itsummation ~] vim /etc/hosts
127.0.0.1
localhost localhost.localdomain localhost4 localhost4.localdomain4
localhost localhost.localdomain localhost4 localhost4.localdomain4
::1
localhost localhost.localdomain localhost6 localhost6.localdomain6
localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.12 itsummation.lab
: wq! Save exit
firewall-cmd
--list-ports
--list-ports
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=53/udp
firewall-cmd –reload
firewall-cmd --zone=public --remove-port=53/tcp
firewall-cmd
--zone=public --remove-port=53/tcp –permanent
--zone=public --remove-port=53/tcp –permanent
firewall-cmd
--zone=public --remove-port=53/udp –permanent
--zone=public --remove-port=53/udp –permanent
firewall-cmd –reload
Systemctl
enable named. service
enable named. service
Systemctl
start named. service
start named. service
Check the status:
Systemctl
status named. service
status named. service
Netstat -ltnp
| grep named
| grep named
Change the network interface settings set your
local network ip address into wan interface file:
local network ip address into wan interface file:
DEVICE="enp0s3"
ONBOOT="yes"
IPADDR="200.100.1.5"
PREFIX="24"
GATEWAY="200.100.1.1"
DNS1="192.168.56.12" <<
set your local ip address here LAN ip address
set your local ip address here LAN ip address
Restart Network Manager:
systemctl restart NetworkManager
Test your dns server;
dig test.com
done 😊
Comments
Post a Comment