Every one of us surfs the web every day, and the internet is now the number one go-to when we have a question, or trying to find out info. But, what is the process that goes behind this? How does the web churn out and give us what we are looking for?
DNS is one of the key components behind the process of us “googling” and getting the answers we want.
What is DNS?
DNS stands for Domain Name System. The DNS is the phonebook of the internet, the system that connects us to the website by matching human-readable domain names (eg. example.com) with the unique ID of the server where a website is stored. The DNS lists domain names with IP addresses, which in simpler terms, their corresponding identifiers. To understand this better, relate this to your phonebook, where you list your friends’ names with their phone numbers. When you enter a domain name (eg. example.com) on your device, it will look up the IP address, and connect them to the physical location where that website is stored.
When we perform a search, we access information online through domain names. Our web browser will then interact through our IP (Internet Protocol) addresses. From here, the DNS will translate a domain name to an IP address so our browser can load the internet resources that we want. Every device connected to the internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for us to have to memorise IP addresses (eg. 192.168.1.1 or more complex alphanumeric), just like the use of our phonebook as mentioned before, we do not need to memorise all the phone numbers and details of our contacts.
How Does DNS Work?
The internet is a highly-demanded necessity in this day and time. Many of us are using the internet throughout the day in our daily lives but do we know how the machines and process work? The internet is a giant network of computers. Every single device used to connect to the internet is assigned a unique IP address, which will help other computers identify it. An IP address is given to each device on the internet. That address is then used to find the appropriate device – just like using a street address to find a particular home.
As IP addresses are a complex combination of alphanumerics, it is almost impossible to have to remember such long strings of numbers and characters for one website, let alone the many websites that you commonly visit. These string of alphanumerics will tend to register like a code in our human brains, instead of a name, or something we can relate to. To solve the challenge, domain names were invented. Domain names use alphabets and users can opt for easy to remember names for their websites. With this, browsing online and searching for websites has been made easy and accessible.
The job of DNS is basically to translate domain names into IP addresses, and point your device in the right direction. A domain name and its matching IP address are called a “DNS record”.
Simple steps to understand how DNS works:
1. You open your browser, types in example.com in the address bar and hits Enter on your keyboard. Immediately, the query will travel into the internet and is received by a DNS recursive resolver.
2. The resolver will then query a DNS root nameserver. A quick check is performed to see if you’ve visited this website previously. If the DNS records are found in your computer’s DNS cache, the other DNS lookup will be skipped and you will be taken directly to example.com.
3. Say no DNS records are found, then a query will be sent to your local DNS server. This is your internet provider’s server, often called a “resolving nameserver”. The resolving nameserver is responsible for providing the correct IP address of a domain name to the requesting host. In this case, where no cached information was found on your computer when you make a request, your computer will then send your request to the resolving nameserver.
4. And if the records are not cached on the resolving nameserver, the request will then be forwarded to what’s called a “root nameserver” to locate the DNS records. The root server will respond to the resolver with the address of a Top Level Domain (TLD) DNS server (eg. .com or .net), which stores the information for its domains. When searching for eg. example.com, the request will be pointed towards .com TLD.
Root nameservers are designated servers around the world that are responsible for storing DNS data and keeping the system working smoothly. Once the DNS record is found on the root nameserver, it will be cached by your computer.
5. After the resolver makes a request to the .com TLD, the TLD server will respond with the IP address of the domain’s nameserver, example.com.
6. Finally, the DNS recursive resolver will send a query to the domain’s nameserver.
7. The IP address for example.com is then returned to the resolver from the nameserver
8. The DNS resolver will then respond to the web browser with the IP address of the domain requested at the start.
When the 8 steps of the DNS lookup is completed and have returned the IP address for example.com, the browser will start to make a request for the webpage.
9. The browser makes a HTTP request to the IP address.
10. The server at that IP address returns the webpage to be rendered in the browser, You will now see the website you requested displayed on your screen.