What is DNS?
DNS stands for Domain Name System. It is a basic requirement for the internet. There are servers that convert a URL to the actual IP address of the machine, which hosts the service for a URL. DNS server maintains the mapping between and URL and IP address. DNS is a database that has a pair of the domain name and IP address for each domain. There can be multiple IP addresses for a URL. This enables a website to load faster and provides redundancy.
Why DNS is required?
The answer is simple, it is easy to remember the alphabetical name rather than numeric values. The same applies to the domain name, which is a string, e.g www.cspsprotocol.com. It is easy to remember the name www.cspsprotocol.com, rather than the hosting server IP (13.4.xx.xx). DNS server is just like a phone directory. Which is located on a central public IP. If a service provider will change the hosting, public IP will change but not the name. Now just need to update the DNS mapping. So without DNS, it is not possible to change the hosting of a website freely.
How does a web browser know the DNS IP address?
While doing web browsing nobody cares what is the IP address of the hosting machine for a domain. This is possible because of DNS servers. But how a machine knows the IP address of the DNS server? The answer is that it is configured on the computer you are using. When a browser tries to send the request out, it first does DNS query to resolve the website name into the IP address.
Where the DNS address is configured?
The configuration is done along with the IP address assignment. Most of the time we use a broadband connection for accessing the internet.
If the wireless router has a static IP configuration then, the DNS server is configured on the wireless router. If the DHCP is used then, then the DNS server address is configured on ISP.
Now maybe the question is how our PC does the lookup for URL from other machines or router? The answer is the machine IP configuration. The machine IP can be static or from the DHCP server. For static IP configuration Go to the change network adapter settings->right click on the network adapter->click on properties, from network properties select TCP/IP settings. The following screen will display.
IP Address, the local IP address of the computer in LAN.
Subnet Mask: This is according to the network, and the IP subnet depends upon network class type. This sets how many bits are for network id and host id. The screen shown is an example of a class c IP address. In this maximum host can be 254.
Default Gateway :
This is the address of the next hope. Here the 192.168.1.1 is the IP address of the router which connects the internal LAN and public internet. By default, all requests will be sent router. The DNS query will also be sent to the gateway. Gateway does the name resolution and the response comes back to the client computer on LAN.
DNS Server Address:
Optionally you can also configure the DNS server if you want to use a separate server for domain name lookup. Some companies may have a dedicated server for DNS only.
In the case where IP allocation is via DHCP. A computer on LAN gets the IP address and default gateway from the DHCP server. Routers have options for the DHCP server.
What is DSN caching?
Caching is the process of holding information for time being. This enables lookup faster. DNS also uses caching for domain name lookup. When a DNS lookup response comes. the response is saved in the cache.
The first cache is maintained in the web browser. This is the first level of caching for domain lookup. So when a URL is typed in the browser address bar, the browser performs the lookup in the local cache. No mapping then a second-level lookup is performed.
The second level of cache is the computer. One can get the caching details from the following command in windows.
C:\>ipconfig /displaydns This will display details in following format. www.cspsprotocol.com ---------------------------------------- Record Name . . . . . : www.cspsprotocol.com Record Type . . . . . : 5 Time To Live . . . . : 9631 Data Length . . . . . : 8 Section . . . . . . . : Answer CNAME Record . . . . : cspsprotocol.com Record Name . . . . . : cspsprotocol.com Record Type . . . . . : 1 Time To Live . . . . : 9631 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 184.108.40.206
The third level of caching is on the internet service provider (ISP) side.