DNS (DOMAIN NAME SYSTEM)
DNS(DOMAIN NAME SYSTEM)
Table of Contents:-
1. Introduction.
2. Name Space.
3. Why do we need DNS.
4. Working or Flow of DNS.
5. DNS Records.
6. Interview questions for Network Engineer L1 asked from DNS.
l INTRODUCTION:-
- DNS
resolves IP address into name. User puts the name of the website into the
address bar and DNS resolves its IP address so that the user can access the
website.
- It uses
client-server model.
- It uses
port 53 of TCP and UDP. I’ll explain this afterwards that in which condition it
uses TCP-53 and in which condition it uses UDP-53.
- It uses 3
messages-
1. Query-
From client to server.
à Its of 2 types- Recursive (Provides complete answer) and
Iterative (Provides partial answer).
2. Reply-
From server to client.
3. Update-
From server to client.
l NAME SPACE:-
A namespace
in DNS (Domain Name System) refers to the hierarchical structure used to
organize domain names. Each domain name is unique within the namespace and is
used to identify a specific location on the internet.
Consider a
domain- server1.north.pnb.com
1. ROOT SERVER- It provides the address of the TLD.
2. TLD Server- It provides the address of the SLD.
3. SLD Server- It provides the address of Sub-domain.
l WHY DO WE NEED DNS:-
When you wanna access any website, the website is actually being hosted on a server and to access any website you would have to reach and communicate with the server. Lets say you wanna access google, so in that case you will have to reach out to the google server.
Now if you are hosting a website online and want the users to access it then you would need an IP address for the server without which the user won't be able to reach out to you. So, all of the websites are being hosted on servers and each server has its particular IP address to make it reachable for the users.
So, if you wanna access any website you would need the IP address of its server. But here the problem arises that every website is being hosted on the different server with different IP address, how would you remember or store this much amount of data in your mind or in your PC where these information is dynamic as well.
Here DNS comes to your rescue. It contains the records of IP addresses of the servers of the websites and you just type the names of the websites in the address bar and the DNS server resolves the IP address for that name and makes the website accessible.
Same thing applies in the case of companies having different servers with different information stored in their infra, there also DNS is required to make the servers accessible for users.
l Working or Flow of DNS:-
As stated above DNS uses UDP and TCP port no. 53. Lets discuss the flow of DNS now-
1. Firstly lets say you wanna access any URL such as abc.com, so to reach the website server you would need an IP address of the server to provide as the destination for the IP header.
So, as you put the URL into the address bar of the browser the first thing your PC would do is check its own cache to look if the IP is stored for abc.com so that it doesn't have to generate a query to the DNS server and if it doesn't find the IP of the URL in its cache it would generate a recursive query to the local DNS server if there is any or the ISP server.
2. If the ISP server has the IP of abc.com stored in it, it would reply with the IP and if not stored then it would also generate a query to the root server which would be an Iterative query.
3. Now. the root server doesn't have the IP address for abc.com but it knows the IP address of the ".com" server. So, it would provide a partial answer in which it would reply with the IP address of the ".com" server.
4. In the fourth step the ISP server will generate another Iterative query seeking the IP address of abc.com but this time to the ".com" server.
5. Now, the ".com" server would reply with the IP address of abc.com to the ISP server.
6. Now the ISP server on receiving the IP of abc.com, first stores the IP into its memory so that it doesn't have to run the process again next time it receives the query for abc.com from any host.
After storing the IP it replies to the host with the IP of abc.com and the host also stores the IP into its cache memory so that next time it needs to communicate to abc.com, it could pick up the IP from its cache memory and doesn't have to generate a query.
** The query generated to the root and ".com" server are Iterative because both of them provided a partial answer- The root server provided the IP of ".com" server whereas the IP of abc.com was provided by the ".com" server.
l DNS RECORDS:-
l Interview questions for Network Engineer L1 asked from DNS:-
## DISCLAIMER:- The questions asked in the interview are all scenario based and indirect, So you should try to understand the concept instead of cramming. You will be fortunate if you receive a direct question from the interviewer.
1. What is DNS?
2. Which protocol and port number does does DNS uses?
3. In which situation does DNS use tcp-53 and in which situation udp-53?
4. The query generated by the host is recursive or iterative?
5. The query generated by ISP server or local DNS server is recursive or iterative?
6. How to check DNS cache on local PC?
ANS- ipconfig/displaydns.
Comments
Post a Comment