
Every website corresponds to its own unique IP address that identifies it among other over a billions of website presence online. Ideally, you could navigate the web merely with the IP address number instead of the domain names, but that just wouldn’t work practically! Now, you are probably wondering about how IP addresses and domains relate to each other. In this blog post. I’ll be explaining to you about how does DNS work behind the scene, what DNS caching is and few important terms related to DNS. Without any further delay, let’s jump into it!
What is Domain Name System (DNS)?
DNS, short for Domain Name System, is an Internet system or Network server that converts alphabetic domain names to their associated numeric IP address. Web address (URL) when typed into a browser, DNS servers points to the IP address of the web server so that it directs to the particular website being hosted. To put it in another way, DNS directs web traffic by linking domain names with the actual web servers. As DNS is all about making connection in between Internet Protocol(IP) addresses and domain names, many people also call it the “Phone-book of the Internet”.
When you are registering a new domain, it is addressed to the particular IP number in the web server. Each of the website hosted in the internet possess its own unique IP address which corresponds to the servers. Thus, if you are looking for the particular web page in the internet, you can just type the name of the domain in the browser that points to the IP number of the web server and allows you to open and access that particular web page you are looking for. This is crucial because, although domain names are convenient for people to remember, computers or machines, access websites based on IP addresses.
If you’ve ever noticed when you type in a domain name on the web browsers, the pages appear magically. But how does that acheally happen?
It’s all thanks to Domain Name System (also known as DNS). See, unlike human who communicate with names, computers don’t understand website names like ‘google.com”, “youtube.com”, They commmunicate using four set of numbers called IP addresses, such as 142.250.184.14. If you’re interested in finding. IP addresses for your interest of domain. on your command prompt just enter ” nslookup google.com”, and bam! The corresponding IP address appears.
Now, Imagine trying to remember all those numbers! It’ll be impossible to remember all of them so that’s why we have DNS. It translates those easy-to-remember website names into those complex IP addresses.
So when you type google.com on your web browser, DNS looks up the Corresponding IP addresses for you from all the registered IP addresses.
Browsers then use these addresses to communicate with web servers to access website information.
How DNS Server Resolves DNS Query?
Now, let’s understand how do DNS Servers resolve a DNS Query in detail.
In a typical DNS query without any caching, there are four DNS servers that work together to deliver an IP address to the client: DNS Resolvers, Root DNS servers, TLD DNS servers and authoritative nameservers.
Now, when you type a domain name into your web browsers, then the whole DNS lookup process begins.
Firstly, your operating system and browser look at their own DNS caches to see if the required information is already stored locally. If not, then the query is forwarded to DNS resolver(also known as Recursive Resolver). The resolver is usually your ISP(internet service provider).
Secondly, once the DNS Resolver receives the request, it first checks its own cache. If not found, it routes your request to root DNS server.
The root DNS servers is the first step in resolving human-readable domain- names into IP addresses. This DNS servers is at the Top Level in DNS hierarchy. There are hundreds of root nameservers placed across different locations throughout the world and there are 12 organizations that manages these DNS servers.
Thirdly, the root DNS server looks at the last section of the request (the .com portion). Although the root server cannot locate the required IP address of the requested website, it tells the resolver where the top level domain (TLD) servers are for .com that you have to route your request to.
Now, the resolver goes on to ask the TLD servers the IP address of the website in question as it has all information of top level domains(such as .com, .net, .org). Although the TLD servers can’t provide us with the required IP addresses, they know where to direct our request. The TLD servers provide the resolver with a list of name servers for that website.
Lastly, the resolver queries the authoritative nameservers to retrieve the required IP information as it knows what the authoritative name servers are. The authoritative name servers contain all the necessary information regarding a particular domain.
Now that the resolver knows the IP of the requested domain, it will cache it for later use. At this point, the resolvers send the IP back to your to your web browsers where it is locally cached as well. The web browsers then passes this IP addresses to web server, which in turn respond by sending website data files that can be interpreted or displayed by the web browser.
Phew! This is the entire working of our DNS Lookup process.Now that we’ve learned what DNS is and how it works.
Let’s understand what DNS caching means quickly-.
Now imagine you visit your favorite website “youtube.com” everyday. It would be pretty slow if your computer had to ask all these DNS servers for the IP address every single time, right? That’s where DNS caching comes in. Think of it like a shortcut!
When the DNS Resolver finds the IP address, it stores it in a special place called a ‘cache’, so, the next time you visit “youtube.com”, your computer checks the cache first. If the IP address is there, it grabs it right away, skipping all those extra steps. This makes websites load super fast.
It’s like remembering a phone number you called recently, so you don’t have to look it up again. It’s all about speed and efficiency.
TTL(Time to Live)
To keep things running smoothly, DNS uses something called TTL, or Time to live. When a DNS resolver stores an IP address in cache, TTL sets a timer. This timer tells the resolver how long it’s allowed to keep that information. Once the timer runs out, the resolver has to go back and check for the latest IP address. This is important because website IP addresses can change. TTL ensures that your computer gets those update while still enjoying the speed benefits of caching.
Terms related to DNS
If you are reading this post, chances are great that you are willing to understand how DNS works. There are several record types, places to point things, innumerable IP addresses, and many other things that just don’t make sense and seem incompatible. Hopefully, this post will help you understand some of the terms related to DNS Management and why using particular types are advantageous in certain circumstances.
- Domain Registrar
A domain registrar is the service provider where internet domain names are purchased and domain registration is maintained and managed. And the registrar is where the domain name-servers are specified.
Most registrars include basic DNS service with the cost of domain registration. As a result, unless you add custom name-servers to the domain, the domain will use the registrar’s standard name-servers. It means in most of the cases, by default, DNS records are managed by the registrar.
- NameServers
‘Nameservers’ in most of the cases is used interchangeably with DNS servers and is a server on the internet specialized in handling queries regarding the location of a domain name’s various services. To be more precise, nameservers are simply computers running DNS software. When you register a domain, you can assign nameservers linking your domain’s information to the service, which in most cases are managed by the registrar or hosting company itself. If you want to migrate a registered domain, you also require to switch its nameservers and wait for the changes allowing once more propagation.
Most nameservers will come in sets of two or three and registrars will provide you plenty of spaces to enter several nameservers for your domain as shown above in case of AGM Web Company.
For your domain, it is important to have it’s nameservers indicated wherever you’re aiming for your site’s DNS records to manage. For the vast majority, their domain’s nameservers will point at their web host since majority of which have measures set up to necessarily set DNS records for their clients.
- Zone Files
Your domain’s zone file contains all of its DNS-related settings such as mappings between your domain names, IP addresses and other resources organized in the form of text representations of resource records and are stored within your nameservers. Consider an example, each record connected with the domain enter the zone file in simple text format thereby simplifying its interpretation and migration procedure.
When you make alteration to your DNS settings, it means you’re updating your zone file. Most changes usually take place through the graphical interface. However, most registrars and web hosts enable you to export copies of your zone file for backup purposes as well.
- CName
CName doesn’t point users towards a specific IP address, but instead, towards other domain names. A record maps domain name servers directly to its corresponding IP addresses in case IP address are known and stable. Whereas a CName or Canonical Name record maps a name to another domain address rather than an IP address. Also, it should merely be used if there are no records on that particular name.
This means users can visit the website regardless of the address they enter on their navigation bar to view. In the example above, when a visitor types agmwebhosting.com, they are automatically redirected to the www.agmwebhosting.com, which in turn leads to a specific IP address if you configured an A record.
Technically, you are recommended to set up both domain name and sub domain variations of an URL to direct to the same website using A name records. However, you should always aim to use a default or ‘canonical’ domain name to avoid search engines penalizing you for duplicate content.
- MX Record
MX(short for Mail Exchanger) records are certified and verified resource records in DNS that are used to help route email according to the domain owners preference. The MX record itself specifies a mail server responsible for delivering mail when this type of request is made to the domain. They differ from A Records and CNAMEs in the way that they also require a “preference” value as a part of their entry to prioritize delivery of the mail in case if multiple mail servers are available.
The different priority number values pointed to different subdomains with two mail exchanger records is shown in the above image. These subdomains are also addressed at two different email servers that are designated to manipulate email. The MX record with less priority number (“0” in this case) is the first one must be attempted for email delivery. If the server could not succeed to handle this mail request, the next lower priority number is considered, which is 10 in above image.
Also, some email providers have only one MX record and some more than two as well. The number of MX entries that needs to be created depends largely on the mail provider and how they wish mail servers load to be manipulated.
- Text-To-Live
TTL(short for Text-To-Live) is a setting that informs your nameservers how often it should update or shall stay in cache on systems requesting your DNS records. Take an instance, if you shift your A record and the TTL is set to two hours, it won’t start propagating till that time. Today’s registrars enable you to set your TTL settings to low limits such as two to five minutes merely. In practice it is not that necessary to set low TTL times for A Records and CName records but having this flexibility is handy for advanced users.
Conclusions
Managing your own DNS can be a tricky activity, especially if you haven’t ever considered what this means or if you haven’t ever seen a DNS record. I hope this post will make you aware of the fact how DNS actually works and why its record types is so essential to know from the time it is entered into the browser to time of handling your request in the nameservers.