DCF Project
DNS Protocol DNS icon
Table of Contents
Domain names
Root server
TLD server
Authoritative name server
Second level domain
Types of DNS queries
Iterative query
Recursive query
Non-recursive query
DNS protocol Message Syntax
DNS Syntax Section’s Format
Header Section Format
Question Section Format

In the human world, people use names to identify different things like other people, places, things, etc., unlike the computer world. Computers communicate and identify each other by using numbers like I.P. addresses. To make communication between humans and computers possible, DNS was developed. DNS stands for Domain Name System and resolves names to numbers; it resolves domain names to I.P. addresses. In other words, when we type a web page's name in the browser, DNS converts it to the I.P address of that website so it is understandable for the computer. then, the DNS server searches its database to find a matching I.P address for that name. DNS can be referred to as the phone book of the internet because it works like a phonebook; wherein you search for people’s names and you find their numbers.

Domain names

Names that we type in a browser URL field like “google.com” are domain names. ICANN which stands for “Internet Corporation for Assigned Names and Numbers” manages these domain names. ICANN is an American non-profit organization founded by Jon Pastel in 1998. This organization is responsible for the maintenance, stability, and security of databases related to namespace and numerical spaces of the internet.

Root server

In the hierarchy of DNS, the top level is the root. There are 13 sets of roots with unique I.P. addresses placed around the world and they are operated by 12 organizations. The root server provides a list of authoritative name servers for each of the TLDs.

TLD server

Refers to the last part of the domain name or the top-level domain. this server stores address information of top-level domains like:

country-code TLDs that represent geographical locations like .ca for Canada. it Also provides a list of authoritative name servers for all domains.

Authoritative name server

These servers are the last stop of the DNS query and the final authority which knows the I.P. address and has a collection of domain names with their associated I.P. addresses.

Second level domain

The part of a domain that comes before TLD. Like “google” in “google.com”

Types of DNS queries

iterative query



  1. Requesting host sends the request to the local DNS server. If the server has the I.P address in its cache memory It will give back a response.
  2. If it does not know the I.P. address, it will send a request to the root server. The root server does not have the I.P. address, but it sends back a response for the local server that contains information on whom to contact.
  3. Then the local server sends a request to the TLD server as per the root server told. The TLD server also sends back a response with information on whom to contact next.
  4. In the last step, the local server sends a request to the authoritative name server and receives a response containing the requested I.P. address. The local server stores this I.P. address in its cache for the next time.

Recursive query



  1. Requesting host sends the request to the local DNS server.
  2. The local server forwards this request to the root server.
  3. The root server sends this request to the TLD server.
  4. TLD server redirects the request to the authoritative name server.
  5. Authoritative name server sends back the response including the I.P. address and the response comes back to level by level in the recursive format that it was sent.

Recursive query
source: NextGenSecurity (https://nextgensecurity.info/2020/08/31/dns-deep-dive/)

Non-recursive query

To prevent additional bandwidth consumption and to reduce the load on servers, DNS local servers save the I.P. addresses of the previously visited websites in their cache and will respond to the query with the I.P. address upon receiving it and there is no need for further communication with other servers.

DNS and Webpage Query

DNS protocol Message Syntax

The structure of the message created when requesting DNS consists of five section: Header, Question, Answer, Authority, and Additional. message syntax

DNS Syntax Section’s Format

Header Section Format



header section format

The Identification field verifies that the responses answered to the client's query are related. The client gives a different number each time it sends a query request, and the server replies by copying the number to the corresponding response message. The Parameter field (Flag field) is responsible for letting the server or client know a lot of important information about the DNS packet. It determines how the query is handled by the server. This field contains eight bits of information. The information of each bits represents the following.

Question Section Format



Question section format

Answer, Authority, Additional Section Format

All three sections are sharing same Formation.

photo from three section