Prerequisite – Domain Name System (DNS)
Need of DNS :
There are 232 IP Addresses (approximately 4, 294, 967, 296). With growth of internet at a rapid pace came issue of remembering websites with their IP Address (not an issue if superhuman or bot pretending to be human). This issue was resolved using DNS. Domain Name System is method of resolving human-understandable URLs into their respective IP addresses. While you enter URL (this URL is known as FQDN – Fully Qualified Domain Name) into browser, DNS takes care of looking at actual IP address associated with website.
DNS Look-Up :
To resolve such DNS queries, there are Domain Name Servers built across world that takes your DNS look-up request and resolve it. There are 5 types of Name Servers –
- Caching Name Servers.
- Recursive Name Servers.
- Root Name Servers.
- Top Level Domain (TLD) Name Servers.
- Authorative Name Servers.
Caching and Recursive Name Servers are generally provided by Internet Service Providers. Purpose of Caching Name Server is to store known domain names for certain amount of time (similar to caching in data storage). Recursive Name Server performs Full Name Resolution. There are 13 Root Name Servers across globe, responsible for directing requests to appropriate TLD Server.
- When you type FQDN in your browser, it checks host files already available in your system. A host file has entries as follows –
127.0.0.1 localhost 220.127.116.11 www.google.com
- If the IP Address is not found in Host files, then DNS look-up is carried to Caching Name Server, which stores domain names for certain amount of time.
- If caching name server does not resolve look-up, it is then transmitted to Recursive Name Server. Recursive name servers are responsible to perform full DNS Resolution requests.
- The request from Recursive Name Server is transmitted to 13 Root Name Servers using Anycast (It is technique that is used to route traffic to different destinations depending on factors like location, link health and congestion).
- Root Name Server responds to DNS Look-up with name of TLD Name Server that should be queried.
- For each Top Level Domain in Domain Name (A top-level domain is part of domain that comes after the dot, for example, com, org or net) there is Top Level Domain (TLD) Name Server. TLD server responds to DNS Look-up with redirect, informing your system about which Authorative Name Server to contact.
- Finally, DNS Look-up is redirected to Authorative Name Server for resolving website name and it provides actual IP Address of the server.
This strict hierarchy maintains stability of internet by resolving every lookup in correct manner. This protects against malicious redirecting traffic. Nowadays devices have built-in local cache servers to prevent performing DNS lookup for every new TCP connection.