Shivam Verma
Shivam Verma

Reputation: 99

How dns servers work know the ip address of website?

My question is that suppose my website is "xyz.com" I can access it anywhere in the world, but I'm curious to know how does all the dns servers know the ip address of my website..? I'm little bit confused..

Upvotes: 4

Views: 4932

Answers (4)

Rudra Khot
Rudra Khot

Reputation: 39

Your computer (or device) first checks its local DNS cache to see if it already knows the IP address for the domain name. If the address is cached, it uses that to connect to the website. If the address is not in the local cache, your computer sends a query to a recursive DNS resolver. This is often provided by your ISP (Internet Service Provider) or a public DNS service (e.g., Google DNS or Cloudflare DNS). The recursive DNS resolver first queries one of the root DNS servers. Root servers are responsible for directing the query to the appropriate Top-Level Domain (TLD) DNS servers. The TLD DNS server then provides the address of the authoritative DNS server for the domain example.com. Authoritative DNS servers hold the actual DNS records for the domain. The authoritative server responds with the IP address of the website.

Reference: For Complete explaination check this https://youtu.be/iSz-AVoSHJk

Upvotes: -1

Anjali Shyamsundar
Anjali Shyamsundar

Reputation: 555

DNS resolution process

  • URL resolution in DNS happens from right to left.
  • DNS comprises of Root Servers, Top Level Domain(TLD) and Authoritative Servers

For the example www.example.com :

  • Root Server queries the TLD for '.com' extension
  • TLD searches the DNS cache for the domain, if not it queries the corresponding authoritative server for the domain 'example.com' to finally get the IP address for the host www.example.com, then return that IP address to your computer.

Upvotes: 1

That's why there are DNS Root Servers.

At the top of the DNS system are DNS root servers. There are approximately 500 root servers distributed around the planet, addressed via 13 IP addresses. These root servers are the only ones that contain the entire list of all domain names and IP addresses. So eventually, a DNS request might make it all the way to the DNS root servers if no other DNS server has the answer. If there is still no answer at the root level, then the DNS request fails, and your browser returns an error. Source

Upvotes: 0

Michael B
Michael B

Reputation: 12228

The main process that resolves an IP Address through DNS is referrals. A DNS Server will go through a process to find the Authorative Nameserver for your domain. The Authorative Nameserver is the server that is configured to answer queries for that domain. i.e. the godaddy DNS Servers, if you have purchased, and configured a domain name through them.

If you go to www.example.com from your PC, it will send a query to your configured DNS server, asking for www.example.com

If your configured DNS Server knows that answer already, i.e. it has been asked the same question recently, it will return the answer from cache (as long as it hasn't expired)

If your configured DNS Server doesn't know, then it will find out. In order to find out what server knows the answer, it needs to look up the name server for example.com first.

So the first query the nameserver makes is to the root domain "." (All DNS Servers should have these configured) to find out the nameservers for the .com domain.

When it has an address for the .com domain's nameservers, it will send a query asking for the nameserver for example.com

when it has the address for example.com's nameservers, it will send the original query, for www.example.com, to that server, and return the answer to you (and put a copy in its cache incase anyone else asks)

Note: If you were looking for www.test.example.com then it would have asked example.com for the nameservers for test.example.com instead.

Upvotes: 5

Related Questions