Completely How to Install DNS Server on Debian 10

DNS (Domain Name System) is an important service in network infrastructure that helps to associate domain names with IP addresses. DNS Server enables communication between computers and web servers on the internet. In this article, we will discuss how to install DNS Server on Debian 10.

Advantages of using a DNS server on Debian 10

Using DNS Server on Debian 10 has several advantages, including:
    • Improving Network Performance By using a DNS Server, the process of finding the IP address of a domain name will be carried out more quickly and efficiently. This will make your network connection faster and more stable.
    • Easy to Manage By using DNS Server, you can manage your entire network through one central point. This makes it easier for you to set up and change network configurations easily.
    • Improving DNS Server Network Security can help prevent outside attacks by using firewall features and security systems embedded in the DNS Server.
    • Optimizing Access to the Internet By using a DNS Server, you can choose the fastest available DNS Server. This will speed up access to the internet and reduce loading times on websites.
    • Save Costs By using a DNS Server, you don’t have to pay fees to use DNS services from other DNS service providers. You can take advantage of the DNS Server for internal networks at no extra cost.

How to Install DNS Server on Debian 10

1. Preparation Before Installation

Before installing DNS Server on Debian 10, make sure that the Debian 10 operating system has been installed and updated to the latest version. In addition, you must also have root access or superuser access.

2. Installing the DNS Server

2.1 First Steps

The first step is to install the BIND9 package using the following command in the terminal:
$ sudo apt-get install bind9 bind9utils bind9-doc

2.2 DNS Server Configuration

After the BIND9 installation is complete, the next step is to configure the DNS Server. The steps are as follows:

2.2.1 Forward Configuration

Open the BIND9 configuration file using the following command in a terminal:
$ sudo nano /etc/bind/named.conf.options
Look for the following line and change it with the DNS Server provider you are using:
forwarders { 8.8.8.8; 8.8.4.4; };
Save and exit the text editor.

2.2.2 DNS Zone Configuration

After configuring the forwarding, next is the DNS zone configuration. Open the BIND9 configuration file using the following command in a terminal:
$ sudo nano /etc/bind/named.conf.local
Add the following DNS zone configuration:
zone "contoh.com" { type master; file "/etc/bind/db.contoh.com"; };
Save and exit the text editor.

2.2.3 DNS File Configuration

Next, create a DNS file using the following command on the terminal:
$ sudo nano /etc/bind/db.contoh.com
Add the following DNS configuration:
$TTL 604800 @ IN SOA ns1.contoh.com. admin.contoh.com. ( 2022031301 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns1.contoh.com. @ IN A 192.168.1.1 ns1 IN A 192.168.1.1
Save and exit the text editor.

2.3 Configuring Firewalls

The final step is to add firewall rules so that the DNS Server can be accessed via public networks. Add firewall rules using the following command in the terminal:
$ sudo ufw allow 53 $ sudo ufw reload

3. Test the DNS Server Configuration

After installing and configuring the DNS Server, the next step is to test whether the DNS Server is running properly. Here are the steps:

3.1 Configuration Test

You can test the configuration by using the following command in the terminal:
$ sudo named-checkconf $ sudo named-checkzone contoh.com /etc/bind/db.contoh.com
If no error messages appear, it means that the configuration was successful.

3.2 DNS Connection Test

You can test the DNS connection by using the following command in the terminal:
$ dig @localhost contoh.com
If the DNS Server has been running properly, then the results that appear should be like this:
; <<>> DiG 9.11.5-P4-5.1+deb10u6-Debian <<>> @localhost contoh.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45444 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;contoh.com. IN A ;; ANSWER SECTION: contoh.com. 604800 IN A 192.168.1.1 ;; AUTHORITY SECTION: contoh.com. 604800 IN NS ns1.contoh.com. ;; ADDITIONAL SECTION: ns1.contoh.com. 604800 IN A 192.168.1.1 ;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Sat Mar 13 19:45:07 WIB 2023 ;; MSG SIZE rcvd: 85

Conclusion

In this article, we have discussed how to install the dns server on Debian 10. After installing, we have also configured the DNS Server and tested whether the DNS Server is running properly. By following the steps above, you can install DNS Server easily and allow you to use DNS services on your network.
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments