RHCE-7: EX-300: Configure a caching-only name server

By | October 9, 2018
Pre Requisites.

Change the DNS of you system to 127.0.0.1. In our case system1.example.local
IP Details

IP: 192.168.12.71/24
Gw: 192.168.12.71
DNS: 127.0.0.1

We will following setup.


Restart Services

#systemctl restart network

Verify local DNS

#cat /etc/resolv.conf
nameserver 127.0.0.1
Install unbound
# yum install -y unbound
# systemctl enable unbound

Firewall

# firewall-cmd --permanent --add-service=dns 
# firewall-cmd --reload

Avoid errors about server-keys :

# unbound-control-setup

Open the file /etc/unbound/unbound.conf for editing, and add the following lines, Please refer to above diagram for reference

#vi /etc/unbound/unbound.conf
interface: 0.0.0.0
access-control: 192.168.12.0/24 allow

We have setup example.local domain in our network. Same domain will be used with dns

forward-zone:
    name: "example.local"
    forward-addr: 192.168.12.250

domain-insecure: "example.local"

Verify Configuration

# unbound-checkconf

Restart Services

#systemctl status unbound
#systemctl start  unbound
Testing

Check for some random domain names

#dig example.local @localhost
#dig google.com  @localhost
#dig gptbazaar.com  @localhost

Check the stored cache

#unbound-control dump_cache
#unbound-control dump_cache | grep gptbazaar

Video Explanation

Youtube

Share This Post

Leave a Reply

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