What is DNS and How DNS works?
The Domain Name System (DNS) is the phonebook of the Internet. Here what it is and how it works.
What is DNS?
A Domain Name System (DNS) first emerged in the early 1980s. It represents a system of interconnected servers that store registered domain names and Internet Protocol (IP) addresses.
As the Internet grew, it became an unavoidable part of online interaction. The majority of internet users are not even aware of DNS and the huge favor it does us. Without DNS, you cannot access any website by typing a URL in your browser.
Computers talk to each other using IP addresses. Since humans cannot memorize thousands of strings of numbers, we have to use domain names instead of IP addresses. It is much easier to remember to type kbsuperuser.com
into your browser than 123.154.89.000.
As mentioned earlier, your favorite website might have an IP address like 193.154.216.34, but this is obviously not easy to remember. However, a domain name such as example.com is something people can recognize and remember. DNS maps domain names with IP addresses enabling humans to use memorable domain names while computers on the internet can use IP addresses.
How does DNS work?
The process involves converting a hostname into a computer-friendly IP address. An IP address is given to each device on the Internet, and that address is necessary to find the appropriate Internet device - like a street address is used to find a particular home. When a user wants to load a webpage, a translation must occur between what a user types into their web browser (example.com) and the machine-friendly address necessary to locate the example.com webpage.
In order to understand the process behind the DNS resolution, it’s important to learn about the different hardware components a DNS query must pass between. For the web browser, the DNS lookup occurs "behind the scenes" and requires no interaction from the user’s computer apart from the initial request.
4 Servers involded during an installation of a webpage:
- 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.
Recursive DNS resolver
The recursive resolver is the computer that responds to a recursive request from a client and takes the time to track down the DNS record. It does this by making a series of requests until it reaches the authoritative DNS nameserver for the requested record (or times out or returns an error if no record is found). Luckily, recursive DNS resolvers do not always need to make multiple requests in order to track down the records needed to respond to a client; caching is a data persistence process that helps short-circuit the necessary requests by serving the requested resource record earlier in the DNS lookup.
Authoritative DNS server
Put simply, an authoritative DNS server is a server that actually holds, and is responsible for, DNS resource records. This is the server at the bottom of the DNS lookup chain that will respond with the queried resource record, ultimately allowing the web browser making the request to reach the IP address needed to access a website or other web resources. An authoritative nameserver can satisfy queries from its own data without needing to query another source, as it is the final source of truth for certain DNS records.
The 8 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.
- The browser makes a HTTP request to the IP address.
- The server at that IP returns the webpage to be rendered in the browser.
What is a DNS resolver?
The DNS resolver is the first stop in the DNS lookup, and it is responsible for dealing with the client that made the initial request. The resolver starts the sequence of queries that ultimately leads to a URL being translated into the necessary IP address.
Note: A typical uncached DNS lookup will involve both recursive and iterative queries.
It's important to differentiate between a recursive DNS query and a recursive DNS resolver. The query refers to the request made to a DNS resolver requiring the resolution of the query. A DNS recursive resolver is the computer that accepts a recursive query and processes the response by making the necessary requests.
DNS Records
DNS server created a DNS record to give important information about the domain or hostname and its current IP address.
The common DNS record types are:
- Address mapping record (A record): Address mapping record is known as ‘A record’, it is a host of DNS record which stores a hostname and its corresponding IP address, it means that to provide the IP address associated with the domain name. It is a type of DNS record .
- IP version 6 address record (AAAA record): Internet Protocol version 6 record is the second type of DNS record and is also called as ‘AAAA record’. The ‘AAAA record’ stores the information of hostname and IP address related to version 6.
- Canonical Name Record (CNAME record): The Canonical name record is shortened as ‘CNAME’. The ‘CNAME’ maps one domain name to other, for example, the ‘CNAME’ record can map the web address which is taken to the actual website.
- Mail Exchanger Record (MX Record): Mail exchange record is called an MX record. It represents the mail server that is responsible for accepting email messages on behalf of the domain name, all the emails sent to the recipients first will be sent to the mail server with the IP address and then the recipient gets that email.
- Name Server Record (NS Record): The name server record is shortened as an ‘NS Record’. It specifies the domain name of the name server. This record is present at the top of your domain, these are public and these types of records are store only at specific locations.
- Reverse-lookup pointer record (PTR Record): A reverse-lookup pointer record is also known as a PTR record. It provides a domain name that is associated with an IP address. It is opposite to the ‘A record’. The PTR record is used in the lookup of DNS.
- Certificate Record (CERT Record): The certificate record is shortened as ‘CERT Record’. It stores the encrypted certificates and provides information to the authentic recipients only.
- Service Location (SRV Record): The service location records store the data about location (i.e. hostname, port number) in the domain name server. It is a DNS resource record that is used to locate domain controllers for the active directory.
- Text Record (TXT record): A text record is the type of DNS record that contains text information for sources outside of the domain, also carries machine-readable data such as encryption, sender policy, etc.
- Start of Authority (SOA Record): The start of authority record is a type of DNS record that contains information about DNS zone files, domain serial number, and especially regarding zone transfer, its format is specified in RFC 1035.
DNS Query Types
Query Coe |
Query Type |
---|---|
A |
Host Address |
NS |
Authoritative name server |
MD |
Mail destination |
MF |
Mail forwarder |
CNAME |
Canonical name for an alias |
SOA |
Start of a zone of authority |
MB |
Mailbox domain name |
MG |
Mail group member |
MR |
Mail rename domain name |
NULL |
Null RR |
WKS |
Well known service description |
PTR |
Domain name pointer |
HINFO |
Host information |
MINFO |
Mailbox or mail list information |
MX |
Mail exchange |
TXT |
Text strings |
AXFR |
Transfer of an entire zone |
MAILB |
Mailbox-related records |
MAILA |
Mail agent RR |
ANY |
All records |
STEP BY STEP DNS
Sources:
What Is a Domain Name System (DNS) & How It Works? | PhoenixNAP KB
What is DNS? | How DNS works | Cloudflare
DNS Types | Top 3 Types of DNS with Explanation (educba.com)
What's Your Reaction?