How does DNS work?
This story begins where I was explaining DNS to a friend who was not from a Computer Science background. He had a doubt on how the browser knows where my website is. So I had to explain to him how that happens. He understood the stuff, so I thought, I can share the story here so that others can also read.
So here it begins…
So it’s more like a gang searching for the guy they want to take revenge on. The gang leader is the user. The hired kidnapper is the web browser and the guy to take revenge on, say, www.anandj.xyz. So, the manhunt begins. The gang leader(user) tells the kidnapper(web browser) that he needs the guy (www.anandj.xyz).
The kidnapper then calls the biggest informant group’s leader(the DNS root name server — generally called the dot(.)). The leader may not know everyone so he has got sub gangs for each area and a leader for that area who knows everyone in that area(called TLDs or Top Level Domain DNS servers, like .in, .co, .xyz). Here since the guy is a .xyz area guy, the gang leader calls .xyz area’s sub gang leader.
The area sub gang leader then tells the address of the guy who knows the guy we are trying to kidnap(the domain anandj.xyz’s nameserver) to the gang leader. Then finally, the informants’ gang leader(resolver) contacts the guy who knows the guy(anandj.xyz’s nameserver) for the address(IP address of the anandj.xyz) of the person of interest and obtains it and gives it to the kidnapper.
Once this is done, the kidnapper(browser) asks the guy to come to a address(HTTP/HTTPS request) and he will arrive at the given place(the server returns the webpage to be rendered) and that’s how the kidnapper lures the guy(the webpage at anandj.xyz) to come and meet the gang leader(user)
Hope you people like this story!