Programming Blog




Article - 05
"Configure DNS Server"

(22.10.2019)

The DNS server is like an Internet phone book. It manages domain names and their IP address.
This is necessary because it is not always easy for the user to enter IP addresses if
you want to get on Google or Progerpadawan.com.
If you want to go to Google.com for example,
you do not have to enter 8.8.8.8, but you can simply enter "google.com".

Process of DNS searching and connection:

  1. The user(client) calls a website.
  2. The client sends a request to the DNS server of the provider to get an IP.
  3. If the DNS server of the provider doesn’t provide information
    about the requested Web page in its cache, it sends a request to the root DNS server
  4. The DNS server looks for information on the website
    and sends the IP and stores everything in cash.
  5. After that the connection is confirmed 3 times:
    1st time by the client, then by the server and again by the client.
  6. Here we go the website appears
Domain namespace
The domain namespace can be displayed hierarchically in a tree structure.
The leaves and nodes of the tree structure are also referred to as labels or levels.
The full domain name (also FQDN = Fully Qualified Domain Name) results from linking these levels.
Thus, the combinations of top-level domain, second-level domain (commonly referred to as domain)
and subdomain the addresses www.domaindiscount24.com,
shop.spiegel.de and de.wikipedia.org. (see example: tree structure domain namespace)

Resolver
A resolver is a program that obtains information from the domain name system.
The program is a kind of switch between an application and the DNS.
The resolver is integrated directly into TCP/IP and
is available there as a software library for name resolution.
The resolver is addressed with the functions "getHostByName" and "getHostByIp".
It returns the IP address of a domain name or the main domain name of an IP address.
For the resolver to work, it needs the IP address of one, better of two DNS servers,
which must be entered in the IP configuration.
As a rule, an IP host receives the IP address of the DNS server(s)
via DHCP or the IP address must be entered manually.

Host file
The file consists of a tabular list of IP addresses and associated hostnames.

Forward Lookup Zones
Offer a resolution from name to address.

Reverse Lookup
Reverse lookup zones are optional and provide address-to-name resolution.

Test and control criteria
In order to be able to check whether the DNS server has been successfully configured
and whether the server can also be reached, you can use 3 different tools:

Linux DNS Server

At Linux DNS server service named bind9

You can use same VMs from my previous article about DHCP

We install bind9 with:
sudo apt-get update
sudo apt-get install bind9

Let’s configure now:
change named.conf.options in /etc/bind
sudo nano /etc/bind/named.conf.options
from:

to:

Ctrl S to save
Ctrl X to exit

Also we need change named.conf.local in /etc/bind
sudo nano /etc/bind/named.conf.local
In DNS zones spelled out connections between domains and IP addresses.
Here now adjust the two zones according to the picture:

Ctrl S to save
Ctrl X to exit


Now we will create two files with names from named.conf.local used default bind files.

forward.local
sudo cp /etc/bind/db.local /etc/bind/forward.maxim.local
sudo nano /etc/bind/forward.maxim.local

Here you must enter the IP of the client and the corresponding domain name.

Ctrl S to save
Ctrl X to exit

reverse.local
sudo cp /etc/bind/db.127 /etc/bind/reverse.maxim.local
sudo nano /etc/bind/reverse.maxim.local

Adjust the IP of the client and the associated domain name according to the picture here.

Ctrl S to save
Ctrl X to exit

Now, to check our configurations, we can use:
sudo named-checkconf /etc/bind/named.conf.local
sudo named-checkzone maxim.local /etc/bind/forward.maxim.local
sudo named-checkzone maxim.local /etc/bind/reverse.maxim.local


If all is OK – all is ok)

With the command
sudo systemctl restart bind9
we restart our Bind9 DNS service.

And check status with
sudo systemctl status bind9


Windows Server

First, we need configure IP:
Open Network&Internet Settings -> Ethernet2 -> network adapter options -> Internetprotokoll, Version 4 (TCP/IPv4)



Now we open in the category Manage, "Add role and features"(Server-Rolle)



For server roles, we select the DNS server.
(The DHCP must also be installed.
To install this one should go back to our previous documentation.)

We now use the DNS administration tool of Windows.
To open it, we use the Windows key and search for "DNS".


In this tool, we will set up the DNS.
Press the small arrows that are left of the folders so we can see all the subfolders.
Right-click on Forward Lookup Zone and select New Zone.


In this window enter "maxim.local"


Select "Primary Zone"


Now enter "maxim.local".
Then press "Next" until the window closes.


Now the reverse lookup zone is configured.
Right-click Reverse Lookup Zone and select New Zone.



Then select "maxim.local", right-click and select "New Host A"(“Neuer Host A”).


After the new host (A) has been configured, we will have this picture in front of us.



Windows client

Like with DHCP client just configure IP like on this picture:


Test

Finally, we test the DNS server on our client by using nslookup
nslookup dns.maxim.local
can check our connection.


If this image matches your result, you have properly configured the DNS server!

Back

Back to start