DEV Community

Vaibhav Namburi
Vaibhav Namburi

Posted on

What happens when you type in www.xyz.com

How Does the Domain Name System work?

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!

Lets go!🚀

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...

Top comments (6)

Collapse
 
sagarb3 profile image
Sagar Bhattacharya

Something in between is missing in the flow , what happens before any server hit , between the system and local router , if the post highlighted that too it would have been great. Magic is just illusion

Collapse
 
m0ntassar profile image
Montassar JDIDI

To be accurate, the original question is "what is the IP Address of the server hosting content of xyz.com"
Did you know that the server that know the IP Address of xyz.com is called the Authoritative Server?
Did you also know that you are offending the terms of use of sketchboard.io/ by taking a screenshot of a board to get rid of the watermark ?

Collapse
 
veebuv profile image
Vaibhav Namburi

Nope the original question was the question I just asked myself. It was something I wanted to know 2.5 years ago and wrote about it in medium and now shifted it across.

AlsoI've been paying for sketchboard since 2017 when I did udemy courses, if that's what you're trying to imply. I'm sure a single screenshot won't kill their business and if it is really that big of an issue I'm sure I can draw that up on something else and post it up 😂

Collapse
 
m0ntassar profile image
Montassar JDIDI

I was pointing the fact that you asked the question with wrong vocabulary, and it could be misleading for beginners:
IP is not IP Address
A domain name does not have an IP Address, a server does

Here is a nicely written article about DNS : cloudflare.com/learning/dns/what-i...

I won't do further comments about sketchboard.io, if you can draw this simple figure, the do it legally

Collapse
 
akshaymarch7 profile image
Akshay Saini

An attempt to answer the age-old interview question "What happens when you type google.com into your browser and press enter?"
github.com/alex/what-happens-when

Collapse
 
veebuv profile image
Vaibhav Namburi

Naaah haha I just moved this from my medium account. I wrote this in 2017. And wow people actually ask what happens during an interview ?

Wth