The easiest way to skyrocket your YouTube subscribers
Get Free YouTube Subscribers, Views and Likes

How To Install And Configure DNS Server In Linux

Follow
Tech Tutorials - David McKone

In this video, we show you how to install and configure DNS server in Linux using Ubuntu 20.04 LTS and Bind

We'll set up a DNS forwarder for Internet DNS resolution, as well as forward and reverse lookup zones for our local network

Useful links:
https://ubuntu.com/download/server

=====================================
Donate through Paypal:
https://paypal.me/DavidMcKone
Donate through Buy Me A Coffee:
https://buymeacoffee.com/dmckone
Become a monthly contributor on Patreon:
  / dmckone  
=====================================

Installation and configuration example:
1) Install Ubuntu and apply the latest patches

2) Install and configure Bind9
sudo apt install y bind9 bind9utils bind9doc dnsutils

3) Configure DNS Forwarding
cd /etc/bind
backup the existing file, named.conf.options e.g.
sudo cp named.conf.options named.conf.options.bak
edit named.conf.options e.g.
sudo nano named.conf.options
so it looks something like this

acl trustedclients {
localhost;
localnets;
172.16.18.0/24;
172.16.19.0/24;
};

options {
directory "/var/cache/bind";

recursion yes;
allowquery { trustedclients; };
allowquerycache { trustedclients; };
allowrecursion { trustedclients; };

forwarders {
1.1.1.2;
1.0.0.2;
};

dnssecvalidation no;

listenonv6 port 53 { ::1; };
listenon port 53 { 127.0.0.1; 172.16.17.10; };
};

NOTE: DNSSec disabled as it was found to cause issues for Ubuntu 20.04

4) Define zone files
backup the existing file named.conf.local e.g.
sudo cp named.conf.local named.conf.local.bak
edit named.conf.local e.g.
sudo nano named.conf.local
so it looks something like this

zone "templab.lan" {
type master;
file "/etc/bind/db.templab.lan";
};

zone "17.16.172.inaddr.arpa" {
type master;
file "/etc/bind/db.172.16.17";
};

check the file for errors
sudo namedcheckconf

5) Create a forward lookup zone
copy an existing file to one with the name used before e.g.
sudo cp db.local db.templab.lan
edit the file e.g.
sudo nano db.templab.lan
so that it looks something like this

;
; BIND data file for templab.lan zone
;
$TTL 604800
@ IN SOA ns1.templab.lan. admin.templab.lan. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.templab.lan.

ns1 IN A 172.16.17.10
dhcp1 IN A 172.16.17.12
fw IN A 172.16.18.254

check the file syntax
sudo namedcheckzone templab.lan db.templab.lan

6) Create a reverse lookup zone
copy an existing file to one with the name used before e.g.
sudo cp db.127 db.172.16.17
edit the file e.g.
sudo nano db.172.16.17
so that it looks something like this

;
; BIND reverse data file for templab.lan zone
;
$TTL 604800
@ IN SOA ns1.templab.lan. admin.templab.lan. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.templab.lan.

10 IN PTR ns1.templab.lan.
12 IN PTR dhcp1.templab.lan.

check the file syntax
sudo namedcheckzone 17.16.172.inaddr.arpa db.172.16.17

7) Edit the server's DNS entry to use it's own DNS server
cd /etc/netplan
edit the yaml configuration file, e.g.
sudo nano 00installerconfig.yaml
change the IP address of the dns server entry and save the file
apply the change
sudo netplan apply

8) Start and test DNS
start bind9
sudo systemctl start bind9
check its status
sudo systemctl status bind9

test DNS is working e.g.
host dhcp1.templab.lan
host 172.16.17.10
ping www.amazon.com

Credits:
LoveLife | Instrumental Prod. Blue Mango | EQMUSEQ.COM by Don Da Vinci
https://soundcloud.com/eqmuseq/loveli...

How To Install And Configure DNS Server In Linux,linux dns configuration step by step,ubuntu dns configuration,ubuntu dns server,install dns ubuntu 20.04,install dns server ubuntu 20.04,how to install dns server in ubuntu,how to install bind9 on ubuntu 20.04,how to install bind9 on ubuntu,bind ubuntu 20.04,bind dns server ubuntu,how to install dns in linux,linux bind dns forwarders,linux bind setup,install bind dns server ubuntu

00:00 Intro
00:57 How It Works
06:31 Build VM
10:38 Install Ubuntu
19:55 Install Bind9
21:30 Configure Forwarder
32:00 Configure Zones
37:48 Configure Forward Zone
45:07 Configure Reverse Zone
49:30 Update Netplan
51:34 Start and Test DNS

posted by ritualomac