DNS(Domain Name System) is a decentralized naming system that converts domain names(such as nlogn.in) to its corresponding IP addresses.
Each device connected to the internet has a unique IP address, which is a 32-bit number for example 184.108.40.206(in IPv4), and remembering such an IP address is almost impossible. The solution to this problem was using English letters, as we humans beings are good at memorizing English words. Hence the concept of Domain Name came into the picture. Each domain name is a combination of English alphabets(generally) and points to an IP address.
To create a mapping between domain names and IP addresses, DNS(Domain Name System) was introduced. Now, whenever a user types a domain name, the DNS translates it into corresponding IP addresses so browsers can load Internet resources.
Types of DNS Server
1. Root Domain Name Server
Root DNS servers are the first step in the process of resolution of Domain name into IP address. The mapping of a domain name to an IP address is a hierarchical process, and the distribution is done on the basis of DNS zones and Root DNS sits on the top of this hierarchy.
The root-level directly responds to the queries that are for the root zone or refer queries to appropriate TLD nameserver. Generally, most of the queries are contains referring to TLD’s hence Root DNS serves are not involved in name resolution.
There are a total of 13 root DNS around the globe starting with the letter a to m. Refer bottom for further insights.
2. Top-Level Domain (TLD) Server
Top-level domains are first-tier domains available for the use of the general public. They are installed in the Root DNS Server and all the other domains are the part of TLDs. For example, google.com or nlogn.in are top-level domains, while nlogn.co.in or google.co.in are secondary level domains.
Top-level domains are divided into two categories:
- Generic top-level domains (gTLD) – These are the domains that are not associated with any country. Example – .com, .org, .net, .int, .mil, .edu, .gov
- Country-code top-level domains(ccTLD) – These are 2 letter domains established for countries or territories. Example – .in, .uk, .to, .ca, .co, .us etc.
3. Authoritative DNS Server
It is the last stop for a DNS query and returns. It is a nameserver that has the original DNS records such as (A record, MX record, etc.). The request to them reach from resolving name servers and they are the endpoint of any request. Note, they don’t respond to recursive queries.
DNS lookup is a process by which an IP address(one of the DNS record) is returned for a domain name by a DNS server. The DNS is lookup is not only limited to returning the IP address, but it can also return all the records associated with a domain name(such as IP, IPv6 address or MX record, etc).
The request to DNS resolver is a recursive request while all other requests in the above diagram are simple(non-recursive) queries.
The above diagram explains how DNS lookup happens and how DNS routes traffic to a website.
- A user opens a web browser, enters nlogn.in in the address bar, and presses Enter button.
- The request for nlogn.in is routed to a DNS resolver, which is typically managed by the user’s Internet service provider.
- The DNS resolver forwards the request for nlogn.in to a root DNS server.
- The DNS resolver again forwards the request for nlogn.in, this time to one of the TLD name servers for .in domains. The name server for .in domains responds to the request with the names of the 2 or 4 (depending on the domain owner) name servers that are associated with the nlogn.in domain.
- The DNS resolver chooses a nlogn.in the authoritative name server and forward the request for nlogn.in to that name server.
- The website’s name server looks in the nlogn.in hosted zone for the nlogn.in A record, to get the associated value, such as the IP address for a web server, 220.127.116.11, and returns the IP address to the DNS resolver.
- The DNS resolver for the ISP finally has the IP address that the user needs. The resolver returns that value to the web browser. The DNS resolver also caches (stores) the IP address for nlogn.in for an amount of time that you specify so that it can respond more quickly the next time someone browses to nlogn.in
- The web browser sends a request for nlogn.in using the IP address that it got from the DNS resolver. This is where the actual content is. For example, a web server running on a Google VM instance that’s configured as a website endpoint.
- The web server or other resource at 18.104.22.168 returns the web page for nlogn.in to the web browser, and the web browser displays the page.
List of Important DNS record types
- A – Returns a 32-bit IP address, commonly used to map a domain name to IP addresses.
- AAAA – Returns a host 128-bit IPv6 address.
- CNAME – Alias one name to another. The DNS lookup will continue by retrying the lookup with the new name.
- TXT – It is used to hold some descriptive text.
- MX – Maps Mail Exchange servers to a domain name.
- NS – Name server record is used to identify the authoritative DNS server for a domain.
Further Note –
- DNS server uses UDP(User Datagram Protocol) to serve requests.
- It works at port number 53.
- The DNS header size is 8 byte.
- DNS query consists of a single UDP request and a reply.
- DNS zone transfer is a process of replicating DNS databases across a set of DNS servers. DNS zone transfer uses TCP.
- To get the list of all the DNS records for a Domain name try $ dig any example.com
- There are a total of 13 logical Root DNS servers available around the world with from as letter.root-server.org and the letter ranges from a to m.
- a.root-servers.org – 22.214.171.124
- b.root-servers.org – 126.96.36.199
- c.root-servers.org – 188.8.131.52
- d.root-servers.org – 184.108.40.206
- e.root-servers.org – 220.127.116.11
- f.root-servers.org – 18.104.22.168
- g.root-servers.org – 22.214.171.124
- h.root-servers.org – 126.96.36.199
- i.root-servers.org – 188.8.131.52
- j.root-servers.org – 184.108.40.206
- k.root-servers.org – 220.127.116.11
- l.root-servers.org – 18.104.22.168
- m.root-servers.org – 22.214.171.124
- ICANN is assigned authority to monitor the operation of the root name server DNS.