DNS (Domain Name System) Overview

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

University KasdiMerbah-Ouargla

Faculty of New Technologies of Information and Telecommunication


Department of Computer Science
Network Administration and Security

DNS (Domain Name System) Overview

Presented by the student


➢ Belmesmar Abdelalim
Introduction:
The Domain Name System (DNS) is a hierarchical decentralized naming system that translates
human-readable domain names into numerical IP addresses. This translation is crucial for the
functioning of the internet as it allows users to access websites, services, and resources using
easyto-remember domain names instead of numeric IP addresses.

Components of DNS:
1. DNS Server:
A DNS server is a computer or network device that stores the DNS database and responds to
DNS queries from clients. It can be authoritative, caching, or a combination of both.
2. DNS Resolver:
The resolver is a component on a client system or network that initiates DNS queries. It sends
queries to DNS servers to obtain the IP address corresponding to a given domain name.
3. Zone:
A zone is a portion of the DNS namespace that is managed by a specific DNS server or
authority. Zones are defined by domain boundaries. 4.
4. Resource Records (RRs):
Resource records are the fundamental building blocks of the DNS database. They contain
information about domain names, IP addresses, mail servers, and other DNS-related
information.

DNS Resolution Process


1. User Types a URL:
A user types a human-readable URL (e.g., www.example.com) into a web browser.

2. DNS Query Initiation:


The DNS resolver on the user's system initiates a DNS query to translate the domain name
into an IP address.

3. Query Resolution:
The resolver first checks its local cache to see if it has the IP address for the given domain. If
not, it sends a query to the root DNS server.

4. Iterative Process:
The root DNS server responds with a referral to the top-level domain (TLD) DNS server
responsible for the domain extension (e.g., .com).
The TLD DNS server responds with a referral to the authoritative DNS server for the specific
domain (e.g., example.com).
The authoritative DNS server provides the IP address associated with the requested domain.

5. Response to User:
The resolver caches the obtained IP address and returns it to the user's system.

6. Accessing the Website:


The user's system can now use the obtained IP address to establish a connection and access
the desired website.

Installing and Configuring DNS on Ubuntu:


1. Installation:
• Install the latest updates
Before we install any packages, we will first update download and install the latest updates with
the apt update and apt upgrade commands on all three systems:

$ update -y && apt upgrade -y

• Install BIND 9 on the DNS server


Next, we're going to install three packages on our DNS server:

• bind9 - The BIND 9 DNS server software.


• bind9utils - Utilities that make working with BIND 9 easier.
• bind9-doc - A documentation package for BIND 9.
To install those packages, use this command:

$apt install bind9 bind9utils bind9-doc -y

2. Configuration:
a. Basic Configuration File (/etc/bind/named.conf):
This file includes configurations for various aspects of Bind9. It often includes references to
other configuration files.

b. Named Options (/etc/bind/named.conf.options):


Configure global options such as listening addresses, recursion settings, and loggin
The named.conf file is BIND 9's main configuration file. That main file includes a reference
to /etc/bind/named.conf.options where we can specify options we need for our configuration.
We'll make four modifications to the /etc/bind/named.conf.options file:

• A forwarders directive that defines what DNS servers this server will forward recursive
queries to.

To make those changes, open /etc/bind/named.conf.options in a text editor (e.g., nano ) and
modify the files to look similar to this:

options {

directory "/var/cache/bind";

forwarders {

8.8.8.8;

8.8.4.4; };

dnssec-validation auto;

listen-on-v6 { any; };

};

c. Zone Files Configuration (/etc/bind/named.conf.local):


Define zone information for your domain, including the domain name, type of zone (master or
slave), and the path to the zone file.
The named.conf.local is typically used to define local DNS zones for a private domain. We will
update this file to include our forward and reverse DNS zones.

• Forward Zone File


In this section BIND9 will be configured as the Primary server for the domain tpdns.net
Simply replace tpdns.net with your FQDN (Fully Qualified Domain Name).
To add a DNS zone to BIND9, turning BIND9 into a Primary server, first To make the changes,
open /etc/bind/named.conf.local in a text editor (e.g., nano ) and add these lines:
zone "tpdns.net" {
type master;
file "/etc/bind/zones/db.direct";
};

Create a directory for your zone files

Next, we'll create a directory to store the zone files we specified in the previous step.

$mkdir /etc/bind/zones/

o Create the forward zone file

Now, we'll create a corresponding zone file /etc/bind/zones/db.direct. The forward zone file allows
the Bind DNS server to resolve names (like vbox.tpdns.net) to IP addresses (like 192.168.1.20).

First, copy the default db.local zone file to /etc/bind/zones/db.direct:

$cp /etc/bind/db.local /etc/bind/zones/db.direct

Open /etc/bind/zones/db.direct in a text editor (e.g., nano ) and make the changes indicated in the
comments below:

$TTL 604800
@ IN SOA vbox.tpdns.net root.tpdns.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS vbox.tpdns.net.
vbox IN A 192.168.1.20
@ IN AAAA ::1
• Reverse zone file

Now that the zone is setup and resolving names to IP Addresses, a Reverse zone needs to be added
to allows DNS to resolve an address to a name.

Edit /etc/bind/named.conf.local and add the following:

zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.inverse";
};

o Create the reverse zone file


Now, we'll create a corresponding reverse zone file /etc/bind/zones/db.inverse The reverse zone
file allows the Bind DNS server to resolve IP addresses (like 192.168.1.20) to names (like
vbox.tpdns.net).
First, copy the default db.local zone file to /etc/bind/zones/db.inverse

$cp /etc/bind/db.127 /etc/bind/zones/cherry.example.rev

Open /etc/bind/zones/ db.inverse in a text editor (e.g., nano) and make the changes indicated in the
comments below:

$TTL 604800
@ IN SOA vbox.tpdns.net root.tpdns.net. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800) ; Negative Cache TTL
;
@ IN NS vbox.tpdns.net.
20 IN PTR vbox.tpdns.net.
2. Starting and Managing DNS:

$sudo systemctl restart bind9 # Start the Bind9 service


$sudo systemctl enable bind9 # Enable Bind9 to start on boot
$sudo systemctl status bind9 # Check the status of the Bind9 service

3. Testing DNS Configuration:

Configure Resolv.conf file


The first step in testing BIND9 is to add the nameserver’s IP Address to a hosts resolver. The
Primary nameserver should be configured as well as another host to double check things. Refer
to DNS client configuration for details on adding nameserver addresses to your network clients.
With the "sudo" privileges, open the /etc/resolv.conf file in a nano text editor:

$sudo nano /etc/resolv.conf

For each DNS name server you plan on using, add a line to the file. The nameserver with the IP
address should be the first thing on the line:

nameserver 192.168.1.20
options edns0 trust-ad
search tpdns.net
domain tpdns.net

Use tools like nslookup, dig, or host to test DNS resolution and query responses.
• Nslookup vbox.tpdns.net

Server: 192.168.1.20
Address: 192.168.1.20#53

Name: vbox.tpdns.net
Address: 192.168.1.20
• Nslookup 192.168.1.20

20.1.168.192.in-addr.arpa name = vbox.tpdns.net.

Conclusion:
DNS is a critical component of internet infrastructure, facilitating the translation of human-
readable domain names into IP addresses. Installing and configuring DNS on a Linux Ubuntu
system involves setting up a DNS server, defining zones, configuring zone files, and managing
global options. Proper configuration ensures efficient and accurate DNS resolution, contributing
to the overall functionality and accessibility of the internet.

You might also like