Domain Name System (DNS)
The phonebook of the World Wide Web.
NETWORKING
1/2/20253 min read


The URL or Uniform Resource Locator sometimes referred to as the website address must first be understood before DNS. The parts of a URL consist of the Protocol (scheme), subdomain, domain, domain name and top-level domain (TLD). As many already know living in this digital age website addresses are in the forms of words and characters for us to understand, however, computers understand numbers. Each URL is assigned a unique Internet Protocol (IP) address. An IP address is made up of four numbers separated by a delimiter "." These numbers can range from 0 to 255. Since URLs are assigned a unique IP address accessing a website through a set of numbers instead of using its name is an alternative method. If the IP address for a URL is unknown try the following;
Open Command Prompt.
(In Command Prompt) type ping www.google.com then press Enter.
Open a web browser
(In Command Prompt) Copy & Paste the IP address results into the web browser's address bar then press Enter.
There are four DNS servers involved in loading a webpage. The following are in order of the DNS Record Request Sequence;
DNS Recursive Resolver > DNS Root Nameserver > DNS TLD Nameserver > Authoritative Nameserver
The DNS Recursive Resolver is responsible for responding to a recursive query from the DNS Client, or simply the client. This is done through a series of requests working its way all of the way up to the Authoritative Nameserver or until it times out, returns an error or finds no record. Throughout the DNS lookup process three different types of queries are used to optimize the time it takes to return a result.
Recursive - a DNS client requires that a DNS server such as a DNS Recursive Resolver to respond to the client with either the requested resource record or an error.
Non-recursive - a DNS Resolver client queries a DNS server for a record it has access to either because it is authoritative for the record or the record exists inside of its cache.
Iterative - a DNS client will allow a DNS server to return the best result possible. If the queried DNS server does not have a match for the query name, it will return a referral to a DNS server authoritative for a lower level of the domain namespace. The DNS client will then make a query to the referral address. This process continues with additional DNS servers down the query chain until either an error or timeout occurs.
Due to caching this process can be successfully completed without many requests as the data may already be present from a previous DNS lookup. For example this data could be found in the browser's cache, within the operating system or the router's cache. The following are the steps involved in a DNS lookup if there is no previous cached records;
The user types "www.example.com" into the web browser's address bar. During this a query is sent into the internet and is received by a DNS Recursive Resolver.
The DNS Recursive Resolver then queries a DNS Root Nameserver (.).
The DNS Root Nameserver then responds to the DNS Recursive Resolver with the address of a DNS Top-Level Domain (TLD) Nameserver.
The DNS Recursive Resolver makes a request to the .com Top-Level Domain.
The DNS Top-Level Domain Nameserver responds with the IP address of the domain's nameserver example.com.
The DNS Recursive Resolver sends a query to the domain's nameserver (example.com)
The IP address for example.com is then returned to the DNS Recursive Resolver from the nameserver.
The DNS Recursive Resolver then responds to the web browser with the IP address of the domain requested.
The web browser make an HTTP request to the IP address.
The server at that address returns the webpage that is then rendered in the browser.
Useful Commands:
ipconfig - displays the DNS cache on the local computer
ipconfig /displaydns - registers the DNS records for the local computer
nslookup - queries the DNS servers for information about domain names and IP addresses
tracert - used to trace a path of a packet for example; the client to www.google.com
dnscmd - a command-line interface for managing DNS servers, tasks, configuring server settings and managing resource records