🌐How to Install and Configure a DNS On a Server

Good to know : What is DNS and real world examples

A DNS server is a server that is used to translate IP addresses into host names so that they are more efficient and easy to remember. Apart from that, DNS is used to identify computers, services, and other resources that can be reached via the Internet or other Internet Protocol (IP) networks.

A simple example of implementing DNS, for example, is when you want to access a website like Google. By configuring the DNS server, you only need to type the address google.com, and not the IP 216.239.38.120, but you can still access the IP above to display pages from google.com.


Configuration

Debian11- Router

Install Packages

The DNS server is a large database that functions to store all the IP addresses used in hostnames. This large database contains a lot of information about IP addresses so when you visit a particular website. For example, youtube.com, the DNS server will translate it to YouTube's IP address.

apt install bind9 dnsutils 

Copy File

Copy the db.local (File Forward) and db.127 (File Reverse) files into a new file. This is so that if there is a config error later, we still have a backup file.

cp /etc/bind/db.local /etc/bind/db.rizwan
cp /etc/bind/db.127 /etc/bind/db.10.1.31

Information :

  • File Forward functions for conversion from DNS to IP Address.

  • Meanwhile, the Reverse File functions to convert IP Address to DNS.

Edit File

nano /etc/bind/db.rizwan
nano /etc/bind/db.10
nano /etc/bind/named.conf.default-zones
nano /etc/resolv.conf
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     rizwanpemula.com. root.rizwanpemula.com. (
                                2         ; Serial
                           604800         ; Refresh
                            86400         ; Retry
                          2419200         ; Expire
                           604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.rizwanpemula.com.
@       IN      A       20.1.1.1
@       IN      NS      rizwanpemula.com.
@       IN      A       20.1.1.20
ns1     IN      A       20.1.1.1
www     IN      A       20.1.1.20
myweb   IN      A       20.1.1.20
mail    IN      A       20.1.1.20
php     IN      A       20.1.1.20
phpmyadmin      IN      A       20.1.1.20
wordpress       IN      A       20.1.1.20

Edit files one by one !!!

Restart DNS Service

/etc/init.d/bind9 restart

Debian11- Server

Install WebServer (Apache2)

apt install apache2

Windows- Client

Now for Windows we need to fill in the DNS and Domain that we are going to. The method is Network Connection> Properties> Internet Protocol Version 4> Advance> DNS


Configuration is Completed

Check DNS service by opening the website

rizwanpemula.com

Last updated