Domain Name System (DNS)

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 IP address by asking the DNS infrastructure.

Important concepts

  • Name servers: It’s important to understand that the DNS isn’t a single server. It’s a complete infrastructure with numerous servers. DNS servers that respond to users’ queries are called name servers.

  • Resource records: The DNS database stores domain name to IP address mappings in the form of resource records (RR). The RR is the smallest unit of information that users request from the name servers. There are different types of RRs. The table below describes common RRs. The three important pieces of information are typename, and value. The name and value change depending upon the type of the RR.

Common Types of Resource Records

Type Description Name Value Example
A Provides the hostname to IP address mapping Hostname IP address (A, relay1.main.educative.io,104.18.2.119)
NS PRovides the hostname that is the authorative DNS for a domain name Domain name Hostname (NS, educative.io, dns.educative.io)
CNAME Provides the mapping from alias to canonical hostname Hostname Canonical name (CNAME, educative.io, server1.primary.educative.io)
MX Provides the mapping of mail server from alias to canonical hostname Hostname Canonical name (MX, mail.educative.io, mailserver1.backup.educative.io)
  • Caching: DNS uses caching at different layers to reduce request latency for the user. Caching plays an important role in reducing the burden on DNS infrastructure because it has to cater to the queries of the entire Internet.
  • Hierarchy: DNS name servers are in a hierarchical form. The hierarchical structure allows DNS to be highly scalable because of its increasing size and query load. In the next lesson, we’ll look at how a tree-like structure is used to manage the entire DNS database.

DNS hierarchy

As stated before, 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 that belong to the authoritative servers of the organization.
  4. Authoritative name servers: These are the organization’s DNS name servers that provide the IP addresses of the web or application servers.

Example of DNS hierarchy for resolution of domain/host names
dns_image.png

DNS names are processed from right to left. In the case of educative.io, the resolvers will first resolve the .io part, then educative, and so on. Visually, however, the DNS hierarchy can be viewed as a tree.

Iterative vs recursive query resolution

There are two ways to perform a DNS query:

  1. Iterative: The local server requests the root, TLD, and the authoritative servers for the IP address.
  2. Recursive: The end user requests the local server. The local server further requests the root DNS name servers. The root name servers forward the requests to other name servers.
    In the following illustration (on the left), DNS query resolution is iterative from the perspective of the local/ISP server:

dns_resolution.png

Note: Typically, an iterative query is preferred to reduce query load on DNS infrastructure.

Other Definitions

  • Hostname is the name given to the end-point (the machine in question)
    • and will be used to identify it over DNS if that is configured (it is the www most of the time)
    • It is usually written in the form hostname.domain.com
  • Domain name is the name given to the 'network'
    • it will be required to reach the network from an external point (like the Internet)
  • Domain name registrar
    • A domain name registrar is a company that manages the reservation of Internet domain names
    • Some examples of these are Network Solutions, GoDaddy, Hover, and Easyhosting
    • Many organizations own and manage their own domains such as Facebook or Google
  • ICANN
    • The body that manages and controls all domain names – and in a way the internet – is ICANN which stands for Internet Corporation for Assigned Names and Numbers.
    • ICANN is the main governing body of the internet as it is the central repository for all IP addresses. A department within ICANN called IANA (Internet Assigned Numbers Authority), distributes IP addresses to 5 Regional Internet Registries which then in turn distributes these to their registrars