DNS: The Basics of internet
DNS is Domain Naming System.
It provide human readable domain to users and translates that domain into IP address to be used by computer and other devices over internet.
TLD’s are top level domain , its the right most part of the domain e.g .com
TLD’s can be : Generic TLD’s (GTLD’s) or Country code TLD’s also known as CCTLD’s.
examples of
GTLD’s : .com, .org, .net etc
CCTLD’s: .in, .de , .us etc
Domain also contain subdomains: Subdomains are the sub division of domain name that allow the creation of separate sections or page within the website.
Importance:
1. User friendly : With DNS, User don’t have to remember or mesmerise the long IP addresses. I even can’t imagine how would have been our lives without it.
2. LB (load balancer): DNS can distribute coming user request across multiple servers which in return contributes towards improving performance and reliability of the website.
3. Scalability: DNS is a hierarchical and distributed system which allow growing number of domains and IP addresses to sustain over internet.
How DNS work ?
DNS Resolvers: The are of 2 types and are used for caching and forwarding the query.
- Recursive resolver: They act as an intermediary between DNS server and the user. Once this resolver find the answer to the query , it cache the information and returns the result so that for next time the result can be used from Cache instead of connecting the server again.
- Forward resolver: As the name suggest , these resolvers just forward the DNS query to other servers and typically these other servers as none other than the recursive servers.
DNS Resolution:
It’s a process that is mixed of iterative and recessive queries utilising the DNS server hierarchical infrastructure and resolver mechanism.
we have gone through resolvers but not yet DNS queries , let’s check them out too.
There are 2 types of queries : Recursive and Iterative.
Recursive queries try to get result via executing it in one go meaning the query will get the full response from DNS server however in Iterative queries the result from DNS will be fetched doesn’t matter whether it is the complete result or not and if not then it will forward the remaining query portion to another server who might be having the remaining response and so on meaning it works in instalments or in a iterative manner to get the whole query result so as the name suggest itself.
Now the last but not the least important part is about Caching and Time to live (also known as TTL). we all have seen and observed this but might not be aware of.
Let me refresh it for you so that you can relate it back and never forget it in future.
Cache: To speed up the DNS resolution , resolvers and servers do cache the result so that next time it can be used directly instead of navigating to DNS server . This results in time saving as well as reducing network traffic.
Negative (-ve) cache: You may be 🤔 thinking, that is this.
It is the process of caching non-existing DNS record. It is important from the perspective that what if someone is trying to click random DNS just to consume resource or create traffic over the internet (think it to be done on massive level).
TTL (Time to live): Each DNS record contain TTL and it specific how long the record can be cached. Once it expires that time (in secs) onwards then it will be taken freshly from DNS server and will be cached and again when the time expire the process repeats.
e.g Banking , you will be logged out after specific duration if no activity preformed for a certain time in order to avoid frauds.
After reading this article, please do check the url you get in your Browser as part of practice.