Run your Own DNS Cache (Upadated - Fedora Server 27)

Roll your own DNS cache - Bypass your ISPs and Googles.

This is a Replacement for my Previous Guide

So we will be using Root Servers.

If you are having issues with DNS resolving and you don’t want to use googles. Try this.
I used Fedora Server 27 for this and will be using the Web mangment for this.

So Log into the Web UI with https://[YourServersIP/FQDN]:9090


Click on terminal
Update the System by “sudo dnf update”

Once i has finished, restart you will be kicked out of the console.
Login and restart the system.

One the System has rebooted, Log back into the Web console and select terminal again.
Time to install Bind.
Type “sudo dnf install bind”

One this has been compleated we need to configure bind.
we will need to update the named.conf file.
Type “sudo nano /etc/named.conf”


We will need to add an ACL for the allowed IP address that can used the server to do DNS querys.
Also need to configure the service to listen on all IPv4 address.

//acl for good clients

acl goodclients{
        192.168.255.0/24; //local subnet
        192.168.254.0/24; //LAN
        192.168.253.0/24; //Wi-Fi Clients
        10.196.89.0/24; // OPENVPN Clients
        localhost;
        localnets;
};

Update the two lines .

        listen-on port 53 { any; };
        allow-query     { goodclients; };

Save the configuration.

Now we need to check the configuration is good. With “sudo named-checkconf” should return no errors.
Now lets enable the service and Start it.
With the following two commands “sudo systemctl enable named.service” and “sudo systemctl start named.service”


Now we need to configure the Firewall rules to allow the client’s query it.
Need to see what interface and zones to update.
“ifconfig”
“firewall-cmd --get-zone-of-interface=ens192”
" sudo firewall-cmd --permanent --add-service=dns"

Now we need to remove the DNS forwarders.


Now lets the test the DNS.

Now test the DNS from another computer

Done :slight_smile:

4 Likes

Bump, for importance

:thinking:

1 Like

Update the Firewall rule as it wasn’t a permanent rule.
Changed “sudo firewall-cmd --add-service=dns” to “sudo firewall-cmd --permanent --add-service=dns”
Having DNS going down isn’t fun after patching