What DNS Mean?
DNS stands for “Domain Name System”. DNS tells us the IP address of the host computer in the network. DNS stores IP addresses and host names.
Let’s understand with a simple example. Tell me how much phone numbers do you remember from your phone’s contact list? 10, 20 or more? I am sure most of the people will not cross the number 10. Because it’s hard to remember the phone number of each and every contact in your phone. But you can easily remember the contact names.
Same is the case there are billions of websites across the globe. It is impossible to remember the IP addresses of these websites. Even it’s hard to remember few of them you often visit.
Now you do not need to remember the IP address. You just need to remember the domain name. The DNS server will find the respective IP address for you.
For example if you are visiting lecturesclub.com. You just type url/domain name in the browser but not the IP address of website. Your default DNS server finds the IP address for you. For the next time your browser saves in cache.
Why did we need DNS Server?
When internet was on its initial stages. The IP address mapping was done within a host file. This host file had only two columns : hostname and IP address. The master file kept on update and all the hosts used that master file to update their own host file.
When internet became globalized. It was hard to maintain a single master file for the whole world. Also all the hosts could not be updated every time. This created a need of a centralized computer system which can store the IP address data. Hence if any host needs an IP address should access central system instead of updating its own host file. This central system was called DNS.
How does DNS work?
A domain name can have many levels. DNS was designed to name those levels. It is basically a naming scheme which give names to various nodes in hierarchical inverted tree structure of DNS.
The following inverted-tree structure shows levels of domain i.e from root to host.
Fig-2: Domain Name System
Each node in the domain name system has unique label. Two or more levels make a complete domain name. Each label can have maximum of 63 characters. Whereas each domain name can have maximum of 128 levels.
A complete domain name is a sequence of levels separated by dots (.). For example www.lecturesclub.com is a complete domain name. We always read from subdomain up to the root.
Remaining lecture will guide you about the labels at each level.
This is at the top of the DNS tree and it is represented by a null string. Null means nothing. A dot (.) can be used to represent the null string. For example “www.lecturesclub.com.”. You Can observe there is a dot at the and the end of “com”
Top Level Domain
This is the name which is used to represent a geographical location, country or an organisation. For example .uk, .pk, .us, .org, .net, .com. For example wikipedia.org, lecturesclub.com, usa.gov
Second Level Domain
This is the registered name of an organisation to use on the internet. For example .wikipedia.com, .lecturesclub.com, .google.com
An organisation can have more than one departments. So organisation can create different domain names for different departments to use over the internet. For example .mail.google.com,.docs.google.com. If subdomain is the last name and there is no need to start with dot.
This is the last name representing a particular computer/node.
This is the process of translating the domain name to it’s IP address. Another name of it is DNS lookup.
Steps in DNS Resolution
- A user types domain name for example “www.lecturesclub.com”
- The request is sent to DNS server of your internet service provider (IPS). If server knows this domain then send back the IP address.
- If DNS server of ISP doesn’t familiar with this domain name, then the request is sent to root server (.)
- The Root server replies back to DNS of ISP with the IP address of “.com” server.
- The ISP server then send request to resolve the DNS query to “.com” server.
- The “.com” server then replies back to DNS of ISP with IP address of “.lecturesclub.com”
- At last the request “www.lecturesclub.com” is sent to server of Lectures Club.
Fig-2: Steps of DNS lookup