Use Bind9 as your DNS forwarder
Use Bind9 as your DNS forwarder
Hi everyone,
In this video I’ll install BIND9 on Ubuntu Server and configure as my local DNS forwarder.
This solution increases efficiency because we save internet bandwidth by storing locally DNS resolutions in BIND9 local cache.
I’ll have to disable systemd-resolved to switch to this new solution and demonstrate local resolutions on Ubuntu Server and MACOS as my client, using Virtualbox Host-only network connection.
Here are my commands:
1 – Install BIND9 package
apt install bind9
2 – Enter BIND9 config folder
cd /etc/bind/
3 – Edit options file to add forwarders 1.1.1.1 and 8.8.8.8
nano named.conf.options
4 – Restart BIND9 after configuring it
systemctl restart bind9
5 – First test
dig @127.0.0.1 linux.org
6 – Change local DNS server
Temporary Solution for Demonstration – runtime:
nano /run/systemd/resolve/stub-resolv.conf
Permanent Solution:
mv /etc/resolv.conf /etc/resolv.conf.systemd
nano /etc/resolv.conf
insert line:
nameserver 127.0.0.1
7 – Stop systemd-resolved
systemctl stop systemd-resolved
8 – Disable systemd-resolved from boot start
systemctl disable systemd-resolved
9 – Add ufw firewall rule for DNS protocol
ufw allow 53/udp
10 – Monitor dns traffic for testing purposes
tcpdump -vv -n -i enp0sN port53
NOTE: N is yout ehternet interface number
11 – Final test – DNS query
dig linux.org
I hope you enjoy this video. Please comment below for any questions or sugestions.
Thanks!
Regards,
LinuxTechSchool
by Linux Tech School
windows server dns forwarder