DNS

The Domain Name System (DNS) is a hierarchical and distributed naming system for computers, services, and other resources in the Internet or other Internet Protocol (IP) networks. It associates various information with domain names (identification strings) assigned to each of the associated entities. Most prominently, it translates readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols. The Domain Name System has been an essential component of the functionality of the Internet since 1985.

The Domain Name System delegates the responsibility of assigning domain names and mapping those names to Internet resources by designating authoritative name servers for each domain. Network administrators may delegate authority over subdomains of their allocated name space to other name servers. This mechanism provides distributed and fault-tolerant service and was designed to avoid a single large central database. In addition, the DNS specifies the technical functionality of the database service that is at its core. It defines the DNS protocol, a detailed specification of the data structures and data communication exchanges used in the DNS, as part of the Internet protocol suite.

The Internet maintains two principal namespaces, the domain name hierarchy and the IP address spaces. The Domain Name System maintains the domain name hierarchy and provides translation services between it and the address spaces. Internet name servers and a communication protocol implement the Domain Name System. A DNS name server is a server that stores the DNS records for a domain; a DNS name server responds with answers to queries against its database.

The Domain Name System originally used the User Datagram Protocol (UDP) as transport over IP. Reliability, security, and privacy concerns spawned the use of the Transmission Control Protocol (TCP) as well as numerous other protocol developments.

Wikipedia

Letā€™s consider the example of a mobile phone where a unique number is associated with each user. We can initially try to memorize some of the phone numbers to make calls to friends. However, as the number of contacts grows, weā€™ll have to use a phone book to keep track of all our contacts. This way, whenever we need to call, weā€™ll refer to the phone book and dial the number we need.

Similarly, IP addresses uniquely identify computersā€”for example,Ā 104.18.2.119Ā is an IP address. We use IP addresses to visit a website hosted on a machine. Since humans cannot easily remember IP addresses when visiting domain names (an example domain name beingĀ educative.io), we need a phone book-like repository to maintain all domain name mappings to IP addresses.

TheĀ domain name system (DNS)Ā is the Internetā€™s naming service that maps human-friendly domain names to machine-readable IP addresses. The service of DNS is transparent to users. When a user enters a domain name in the browser, the browser has to translate the domain name to the IP address by asking the DNS infrastructure. Once the desired IP address is obtained, the userā€™s request is forwarded to the destination web server.

DNS hierarchy

DNS Hierarchy|500

The DNS isnā€™t a single server that accepts requests and responds to user queries. Itā€™s a complete infrastructure with name serversĀ at different hierarchies.
There are mainly four types of servers in the DNS hierarchy:

  1. DNS resolver:Ā Resolvers initiate the querying sequence and forward requests to the other DNS name servers. Typically, DNS resolvers lie within the premise of the userā€™s network. However, DNS resolvers can also cater to usersā€™ DNS queries through caching techniques, as we will see shortly. These servers can also be called local or default servers.
  2. Root-level name servers:Ā These servers receive requests from local servers. Root name servers maintain name servers based on top-level domain names, such asĀ .com,Ā .edu,Ā .us, and so on. For instance, when a user requests the IP address ofĀ educative.io, root-level name servers will return a list of top-level domain (TLD) servers that hold the IP addresses of theĀ .ioĀ domain.
  3. Top-level domain (TLD) name servers:Ā These servers hold the IP addresses of authoritative name servers. The querying party will get a list of IP addresses belonging to the organization's authoritative servers.
  4. Authoritative name servers:Ā These are the organizationā€™s DNS name servers that provide the IP addresses of the web or application servers.
What happens if a network is congested? Should DNS continue using UDP?

Typically, DNS uses UDP. However, DNS can use TCP when its message size exceeds the original packet size of 512 Bytes.
This is because large-size packets are more prone to damage in congested networks. DNS always uses TCP for zone transfers.
Some clients prefer DNS over TCP to employ transport layer security for privacy reasons.

nslookup

root@soumendra:/# nslookup www.soumendrak.com
Server:         169.254.169.254
Address:        169.254.169.254#53

Non-authoritative answer:
Name:   www.soumendrak.com
Address: 172.67.221.9
Name:   www.soumendrak.com
Address: 104.21.24.238
Name:   www.soumendrak.com
Address: 2606:4700:3030::ac43:dd09
Name:   www.soumendrak.com
Address: 2606:4700:3030::6815:18ee

dig

 root@soumendra:/# dig www.soumendrak.com

; <<>> DiG 9.16.1-Ubuntu <<>> www.soumendrak.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46021
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.soumendrak.com.            IN      A

;; ANSWER SECTION:
www.soumendrak.com.     300     IN      A       104.21.24.238
www.soumendrak.com.     300     IN      A       172.67.221.9

;; Query time: 32 msec
;; SERVER: 169.254.169.254#53(169.254.169.254)
;; WHEN: Thu Mar 14 18:28:41 UTC 2024
;; MSG SIZE  rcvd: 79

Also Read

Thoughts šŸ¤” by Soumendra Kumar Sahoo is licensed under CC BY 4.0