DNS (Domain Name System)

From the network protocols earlier, we are aware of what a DNS is. If not, a small recap. DNS is, in simpler words, the phonebook of the Internet. It is known that websites are stored on the servers and they are parsed when the client requests for it. Every website has its unique IP address for identification. We will not be able to remember all the IP addresses to access them. Hence, the DNS has come into play. We type, let’s say, google.com in the browser. Then the DNS will convert the domain name into IP address so that the web content can be retrieved. It is not as simple as it seems. Let us look at it deeper.

How does DNS work?

The process of DNS resolution starts from converting a domain name to a computer-friendly language i.e. IP address. When a domain name is entered in the browser, browser checks for DNS cache on it if you have recently visited. If the domain name is found on the computer’s DNS cache, we will be redirected to the website immediately. If it is not found on the computer’s cache, the query is then forwarded to the local network that is basically Internet Service Provider (ISP) which is called “recursive resolver” or recursive DNS. If the DNS cache is found on the recursive resolver, then we will get the response instantly. If that is not the case, the recursive resolver will start the quest for DNS records in the upper-level server which is the “Root Name server”. These root name servers are overseen by Internet Corporation for Assigned Names and Numbers (ICANN).

Each recursive resolver is aware of all the 13 root name servers. These root name servers contain information about all the Top Level Domains (TLDs). It receives the query from the recursive resolver and based on the extension (.com, .edu, .in, etc.) root name server directs the recursive resolver to a TLD server. The TLD servers are maintained by the Internet Assigned Numbers Authority (IANA).

A TLD name server maintains information for all the domain names that share a common extension such as .org, .com, etc. Let us suppose that a user is searching for facebook.com. Here .com is the TLD. After receiving a response from a root name server, the resolver will send a query to the .com TLD server, which would respond by directing it to an authoritative name server.

Modified source: cloudflare.com

This is the last step of the DNS lookup. The authoritative name server has the information specific to the domain the user is looking for (facebook.com) and it provides the resolver with IP address of that server found in the DNS A record, and if the domain has an alias (CNAME record) it will provide the recursive resolver with the alias domain. In this case, the resolver has to perform the complete DNS lookup again.

Summary of DNS lookup:

  1. A user searches for “xyz.com” in his browser. This request travels into the internet and reaches DNS recursive resolver.
  2. The resolver sends this query to the root name server.
  3. The root name server then responds to the resolver with the IP address of the TLD name server of the domain. In this case, in xyz.com, .com is the TLD DNS name server.
  4. Then the resolver queries the .com TLD server.
  5. The TLD server responds with the address of the domain’s name server or authoritative server, here xyz.com.
  6. Lastly, the resolver sends a query to the domain’s name server.
  7. The domain’s name server responds to the recursive resolver with the IP address of the domain requested, xyz.com.
  8. The DNS resolver then responds to the browser with the IP address of the domain.

After these 8 steps of DNS lookup, the browser will be able to make an HTTP request.

  1. The browser makes an HTTP request to the IP address.
  2. The IP address’s server responds with a web page to the browser.

Who owns DNS root servers?

The ultimate authority of DNS root servers is with the National Telecommunication and lnformation Administration (NTIA). The management of root zone servers is entrusted to ICANN (The Internet Corporation for Assigned Names and Numbers) by the NTIA. Further, ICANN operates servers for one of the 13 IP addresses in the root zone and pass-on the responsibility of the other 12 IP addresses to various organizations.

Why there are only 13 root servers?

There are only 13 root DNS servers as the DNS infrastructure use IPv4 address that is only 32 bits long. The IP address needs to fit in one single packet, that was limited to 512 bytes at that time. Hence only 13 IP addresses can sum up to 416 bytes leaving 96 bytes for the protocol information. Anycast routing is used to distribute the requests to the servers based on the proximity and traffic. There was only one single server long ago but now there is a cluster of servers across the globe.

Where these 13 root servers located?

  1. VeriSign Global Registry Services
  2. University of Southern California, Information Sciences Institute
  3. Cogent Communications
  4. University of Maryland
  5. NASA Ames Research Center
  6. Internet Systems Consortium, Inc.
  7. US DoD Network Information Center
  8. US Army Research Lab
  9. Netnod
  10. VeriSign Global Registry Services
  11. RIPE NCC
  12. ICANN
  13. WIDE Project

What happens if a root server becomes unavailable?

Since the root servers user Anycast routing, if one of the 13 root servers fails, the other 12 servers will be able to serve the purpose for resolver in DNS lookup. The connectivity will not be disturbed if one server goes down.

Recursion and Iteration:

Suppose x lost his keys and he needs to find them. In the recursive process, he looks for the keys until he find. If he doesn’t find the keys, he would return to the instructions saying to look until the keys are found. The iterative solution would be to search in one room for, say 2 minutes, the keys. If he doesn’t find, he would return to the instructions and search in the other room. This process continues until all the rooms are searched.

Apply the analogy to the DNS queries. In the recursive DNS query, the resolver queries all the DNS servers until it has an IP address for the client. In the iterative query, each DNS query responds to the client directly with the next DNS server to look. The client has to send queries to the DNS servers until he receives the IP address of the domain.

The advantage of a recursive query is that it caches the final solution to every query it performs and preserves it for a certain time of time, commonly known as TTL (Time-To-Live). So when a client requests an IP address, if the query is available in the cache, the response would be quicker as the resolver need not communicate with other DNS servers.

Common DNS Record Types:

  1. A (Address) Record: It holds the direct IP address of the domain.
  2. CNAME (Canonical Name) Record: Provides the subdomain or domain to another domain and doesn’t return the IP address.
  3. MX (Mail Exchange) Record: It directs to an email server. Similar to CNAME, it also points to other domain.
  4. TX (Text) Record: This allows the domain admin to add text to the DNS record that actually contains human readable text.
  5. NS (Name Server) Record: This indicates which server actually has the DNS records (authoritative for that domain)

Neologism:

  1. Recursion: A program that repeatedly calls itself until a condition is met.
  2. Iteration: A set of instructions is repeated until a condition is met.
  3. Cache: It is the software or hardware component that stores the data so that it can be made available faster to future requests. This data is the result of the previous computation.
  4. Internet Service Provider (ISP): A company that provides people access to the Internet.
  5. Time-To-Live:
  6. Anycast: It is a network addressing and routing method in which the requests will be directed to different locations. It routes the traffic to the DNS server based on the load and proximity.

References and Related:

  1. Network Protocols
  2. HTTP
  3. Routing Algorithms
  4. IP address errors
  5. OSI Model

4 thoughts on “DNS (Domain Name System)

Leave a comment