Related to DNS server

Hi Everyone,
I studied the DNS topic on the devops pre-requisite course. Here a DNS server is mentioned. My question is
1.whether the dns server is within a system or it refers to a separate system on the same network/ different network
2.from a dns server where we map the hostname/name resolutions is it similar to the /etc/hosts .file if so then the dns server is in a different system.
3.how a hostname/name resolution will be mapped if a dns server is within a system?

  1. A DNS server is nothing more than software running on a computer. It can be anywhere, as long as there is a network route from the computer asking the question (e.g. yours) to the computer running DNS software. The computer you are using right now will be using DNS servers operated by your broadband provider. You would not have reached this site without a DNS server resolving the address kodekloud.com for you.
  2. Yes. Without access to a DNS server, the only way a computer can resolve addresses is those addresses entered in the hosts file.
  3. Not sure what you mean. If you had a properly configured DNS server on your laptop, then you could use it directly. By “properly configured”, it has to know the addresses of other DNS servers that it can ask questions it does not know the answer to.

Computers need to use IP addresses to connect to other computers. Humans like things that make more sense, e.g. kodekloud.com. DNS is like a telephone directory to find the IP address for a given name.

There is a nice animation here (animates as you scroll down the page) which shows what happens when a query is made.

1 Like

Thanks for your clear answers.
My 3 rd question is, suppose if a dns server is within my system if i try to ping some host sites like www.google.com from where it finds the host because in my system i have /etc/hosts file to lookupon similarly i have a dns server setup in the same system where my hosts are also mapped.
In this situation from where does it verifies the host?

If you run a DNS server on your own system, it must be configured with the addresses of other DNS servers that it can ask questions it does not know the answer to itself.

Having a local DNS server is what you do if you want to assign hostnames to everything connected to your own network without having to distribute a hosts file to every machine on the network. It doesn’t matter which machine on your network is running DNS. It should be one that is always powered on though.

Every machine on your local network then uses the local DNS server.

So, local DNS server you set up with the records for your own internal domain, then you configure it to forward for any other request - usually to the DNS servers of your ISP.