, , , , , ,

Domain Name System (DNS) is a networking protocol that converts the human friendly domain name to an IP address. IP addresses (IPv4 or IPv6) uniquely identify the devices connected to the internet and helps in routing the network packets from the source to destination. DNS server can be thought as a directory that maintains the list of all the domains on the internet and its corresponding public IP address.

IPv4 is made up of 32 bits and has approximately 4 billion IP addresses which is not sufficient to assign a unique IP address to each device connected to the internet. Due to exponential rise in the number of devices connected to internet in the last decade and now even a greater proliferation due to Internet of Things (IoT), IPv6 is becoming more common since it’s made up of 128 bits and has a large number of IP addresses (2^128). Some of the IP addresses are reserved to be used inside a private network and hence cannot be assigned to a device connected to internet. One of the special IP address is which is used to identify the host machine and routes all the packets to the host machine itself without sending the packets over to the internet.

IP addresses could be dynamic or static depending upon the network configuration and the use case. Dynamic Host Configuration Protocol (DHCP) server assigns a new dynamic IP address along with other configuration to the device at the time the device is registered with the network. Web server and other devices requiring static IP addresses that does not change over time could be assigned IP addresses which are associated with the MAC address of the network interface.

Top Level Domains

Domain names consist of character strings separated by dot e.g. abc.xyz.com. The string after the last dot represents the top level domain. In this example, ‘com’ is the top level domain and ‘xyz’ is the second level domain. Domain names are hierarchical with top level domain at the root of all the sub-domains defined under the top level domain. Following are some of the most common top level domain names widely used.

  • .com
  • .org
  • .net
  • .edu
  • .gov
  • .io

The top level domains are controlled by Internet Assigned Number Authority (IANA) in a root zone database which is essentially a database of all the available top level domain names.

Domain Registrar

All the sub-domains under the top level domain needs to be unique such that there are no duplicate domain names resulting in name resolution conflicts. Domain registrar controls the list of domains that could be assigned avoiding any duplicates under the top level domain. Each domain registration becomes part of a central domain registration database known as whois database.

DNS Name Resolution

Internet Service Providers (ISP) hosts the DNS servers that maintains a small database of domain names and associated IP addresses. When the DNS resolution request is received by the ISP DNS server, it tries to resolve the domain name and if it doesn’t have the DNS record it delegates the DNS resolution to other DNS servers on the internet.

A domain server that manages a specific domain is called Start Of Authority (SOA) for that domain. Over time, the DNS lookup results propagates from SOA to other DNS servers on the internet. Each DHS server could cache the result of DNS lookup for a specific period of time known as Time To Live (TTL). The TTL value could be configured for each DNS server and allows the DNS lookup to be more efficient with minimal latency. Root name servers are at the top of the hierarchy for a given top level domain and other DNS servers can contact the root name server for the SOA record.

DNS Configuration

A Record

A record is the basic mapping for the host name to the IP address. ‘A’ in the A record stands for the address and associates the IP address to the host name. It is mandatory to have a A record defined for every DNS entry. A record is defined for the naked doamin name i.e. the domin name without ‘www’ sub domain.

CNAME Record

Canonical Name (CNAME) record is used to resolve one domain name to another. It is like an alternative domain name such that anyone accessing the CNAME is automatically directed to the IP address mapped in the A record. CNAME cannot be defined for naked domain name.