How does the internet know what to get you and how to get you your website?
This blog will be relatively shorter than most because it’s straightforward to explain, considering that a few steps are going to be skipped and only the main necessary logic points will be explained!
Side note: have a look at the diagram, that should simplify things for you 😀
When you type in www.xyz.com in your browser what happens?
You set up a “query” or a question to send to a server. The first server your query hits is called the Recursive Resolver, which is usually operated by your internet service provider (Vodafone, Telstra). The recursive resolver knows which other DNS server or domain name system servers to ask the original question of “What is the IP of www.xyz.com” — IP stands for internet protocol, think of it as an address, or perhaps like your phone number.
The first DNS server the recursive resolver talks to is the Root Server which are servers running all over the world and have information about Top Level Domains such as .com/.net. So the recursive resolver asks the root server for DNS info regarding .com. — Note that there's 1000s of servers supporting the root and its the DNS’ job to find the answer to your query quickly!
The Top Level Domain DNS server stores information regarding the second-level domains i.e the .com sever stores information regarding xyz.com. I.e the TLD DNS server responds back with the IP address of the domain’s name server, which gives us the next clue!
The recursive resolver then takes this IP and sends a query to the domain’s name server, this DNS server knows the IP address of our website www.xyz.com and returns to the recursive resolver the IP address of our website.
After all this, the website appears in our browser, and voila done!
PS all this happens in a fraction of a second!
Nothing in programming is magic. Except CSS...