How to Setup Forward Only DNS Server on Ubuntu & Debian
Abstract: verify all files using the following commands. named-checkconf /etc/bind/named.confEnable DNS Forwarding We are configuring this server as forward on
The Domain Name System (DNS) is a hierarchical distributed naming system for computers connected over network. It resolves ip address correspondence to a domain name. A forward-only DNS server does not keep the domain information. If any query comes to this server, it forwards to the configured DNS server. A details information about DNS is available.
This article will help you to configure forward only Domain Name System (DNS) using Bind9 on Ubuntu, Debian, and LinuxMint systems.
Install DNS PackagesBind9 is the most popular DNS server used worldwide. It is available under default apt-get repositories. So use the following commands to install the Bind9 domain name system.
sudo apt update sudo apt install bind9Enable DNS Forwarding
We are configuring this server as forward only dns server. So edit bind configuration file
$ sudo vi /etc/bind/named.conf.options
and add the following settings:
options{ directory "/var/cache/bind"; recursion yes; allow-query { 192.168.0.0/32; 127.0.0.1; }; forwarders { 8.8.8.8; 8.8.4.4; }; forward only; }
Change the DNS server 8.8.8.8 and 8.8.4.4 with suitable DNS server IPs. Using allow-query we can restrict access of dns server to specific IP ranges. To make it public dns server, comment allow-query line.
Verify Configuration FilesAfter making all configuration, verify all files using the following commands.
named-checkconf /etc/bind/named.conf named-checkconf /etc/bind/named.conf.options
If any of the above commands return error or warning, Please fix that before proceeding to the next step.
Restart DNSAfter successful verification of all files, let’s restart the bind9 service using the following command.
sudo service bind9 restartTest Setup
Finally, your DNS server is successfully configured and ready to use. Let’s verify that DNS is properly responding to queries. Below is the example commands to test it.
dig tecadmin.net ; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> tecadmin.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<