Domain Name Server (DNS)
Domain Name Server (DNS)
SERVER (DNS)
DNS CONFIGURATION
WHAT IS DNS
• The Domain Name System (DNS) is the phonebook of the Internet. Humans
access information online through domain names, like nytimes.com or espn.com.
Web browsers interact through Internet Protocol (IP) addresses. DNS translates
domain names to IP addresses so browsers can load Internet resources.
• Each device connected to the Internet has a unique IP address which other
machines use to find the device. DNS servers eliminate the need for humans to
memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer
alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).
How does DNS work?
• DNS recursor - The recursor can be thought of as a librarian who is asked to go find a particular book
somewhere in a library. The DNS recursor is a server designed to receive queries from client machines
through applications such as web browsers. Typically the recursor is then responsible for making additional
requests in order to satisfy the client’s DNS query.
• Root nameserver - The root server is the first step in translating (resolving) human readable host names
into IP addresses. It can be thought of like an index in a library that points to different racks of books -
typically it serves as a reference to other more specific locations.
• TLD nameserver - The top level domain server (TLD) can be thought of as a specific rack of books in a
library. This nameserver is the next step in the search for a specific IP address, and it hosts the last portion
of a hostname (In example.com, the TLD server is “com”).
• Authoritative nameserver - This final nameserver can be thought of as a dictionary on a rack of books, in
which a specific name can be translated into its definition. The authoritative nameserver is the last stop in
the nameserver query. If the authoritative name server has access to the requested record, it will return the
IP address for the requested hostname back to the DNS Recursor (the librarian) that made the initial request.
STEPS IN A DNS LOOKUP:
• A user types ‘example.com’ into a web browser and the query travels into the Internet and is received by a DNS recursive
resolver.
• The resolver then queries a DNS root nameserver (.).
• The root server then responds to the resolver with the address of a Top Level Domain (TLD) DNS server (such as .com or .net),
which stores the information for its domains. When searching for example.com, our request is pointed toward the .com TLD.
• The resolver then makes a request to the .com TLD.
• The TLD server then responds with the IP address of the domain’s nameserver, example.com.
• Lastly, the recursive resolver sends a query to the domain’s nameserver.
• The IP address for example.com is then returned to the resolver from the nameserver.
• The DNS resolver then responds to the web browser with the IP address of the domain requested initially.
• Once the 8 steps of the DNS lookup have returned the IP address for example.com, the browser is able to make the request for
the web page:
• The browser makes a HTTP request to the IP address.
• The server at that IP returns the webpage to be rendered in the browser (step 10).
CONFIGURATION STEPS OF DNS ON
UBUNTU 20.04
• How to Install and configure DNS on Ubuntu 20.04.
• A DNS server is a system server that check a database of Ip address and
clients. It provides to resolve those names to public ip address as
requested. DNS servers run software and communicate with each other
using protocols.
• Domain Name Service (DNS) is an Internet service that contains IP
addresses and fully qualified domain names (FQDN) to other. Computers
that run DNS are called name server
Installing BIND on Ubuntu 18.04 LTS:
Update ubuntu
Installing BIND on Ubuntu 18.04 LTS:
Installing BIND on Ubuntu 18.04 LTS:
Install bind9
Installing BIND on Ubuntu 18.04 LTS:
Installing BIND on Ubuntu 18.04 LTS:
Installing BIND on Ubuntu 18.04 LTS:
BIND 9 is installed.
Configuring BIND 9:
• Now run the following command to check whether you’ve made any
mistakes in the zone file:
Configuring BIND 9:
• Now you have to tell bind to load the data file db.example.com for the
zone example.com.
• To do that, open /etc/bind/named.conf.local file with the following
command:
Configuring BIND 9:
NOTE: Here, @192.168.11.51 is used to tell dig to use the nameserver 192.168.11.51. This is the IP
address of my computer where BIND 9 is running. If you don’t know the IP address of your computer,
run ip addr command to see the IP address of your computer.
Configuring BIND 9:
As you can see in the marked section of the screenshot below, BIND 9 can resolve example.com domain
name to IP addresses correctly.
Configuring BIND 9:
First, open the configuration file for systemd-resolve with the following command:
setting Primary DNS Server on
Ubuntu
• Now, replace #DNS= with DNS=IP_ADDR as shown in the marked
section of the screenshot below. Here, IP_ADDR is the IP address of your
BIND 9 server
• .
setting Primary DNS Server on
Ubuntu
• Now save the file and restart your computer with the following command:
setting Primary DNS Server on
Ubuntu
• Once your computer start’s, run the following command to check your
primary DNS server:
setting Primary DNS Server on
Ubuntu
• As you can see, the primary DNS server is set to 192.168.11.51, the one
that I set earlier.
setting Primary DNS Server on
Ubuntu
• Now I can run dig without saying what DNS server to use and still be able
to resolve example.com as you can see in the screenshot below
setting Primary DNS Server on
Ubuntu
• As you can see, I can also ping www.example.com.
Understanding Zone File Format
• Now that your DNS server is working, it’s time to learn more about the
BIND 9 zone file.
• The zone file db.example.com defines how a domain name is resolved
and what IP it is resolved to, mail servers of a domain, nameservers of a
domain and many more information.
• In our earlier zone file for example.com, $ORIGIN defines a value for
the @ symbol. Wherever you out @, it will be replaced by the value in
the $ORIGIN, which is example.com.
Understanding Zone File Format
• NOTE: Don’t forget the dot(.) after example.com as it is required for the
domain to be FQDN (Fully Qualified Domain Name) and without it,
BIND won’t work.
Understanding Zone File Format
Understanding Zone File Format
• If you don’t put a FQDN in BIND zone file, then the value
of $ORIGIN will be appended to the name. For example, ns1 is not a
FQDN. So ns1 will be ns1.example.com. ($ORIGIN appended at the
end).