What is DNS?
DNS stands for Domain Name System. It is one of the basic thing for internet. There are DNS servers those convert an URL to the actual IP address of the machine which is hosting the service for an URL. DNS server maintains the mapping between and URL and IP. This is a database which have pair of domain name and IP address. There can be multiple IP addresses for an 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. Same applies to the domain name , which is a string, e.g www.cspsprotocol.com. It is easy to remember 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 hosting of a website freely.
How a web browser knows the DNS ip address ?
While doing web browsing no body cares what is the ip address to the hosting machine for a domain. This is possible because of DNS. But how a machine knows the ip address of DNS? The answer is that it is configured in the computer you are using. When a browser tries to send the request out, it fist does query to resolve the name.
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 do the lookup for URL from other machine or router? The answer in machine IP configuration. The machine IP can be static or from 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 IP subnet depends upon network class type. This sets how much bits are for network id and host id. In screen shown is example of class c ip address. In this maximum host can be 254.
Default Gateway :
This is the address of next hope. Here the 192.168.1.1 is the ip address of router which connects the internal LAN and public internet. By default all requests will be sent router. The DNS query will also sent to the gateway. Gateway does the name resolution and response comes back to the client computer on LAN.
DNS Server Address:
Optionally you can also configure the DNS server , if want to use a separate server for domain name lookup. Some companies may have a dedicated server for DNS only.
In case where IP allocation is via DHCP. A computer on LAN gets the IP address and default gateway from DHCP server. Routers have options for DHCP server.
What is DSN caching ?
Caching is the process of holding information for time being. This enables lookup more faster. DNS also uses the caching for domain name lookup. When a DNS lookup response comes . the response is saved in cache.
The first cache in 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 local cache. No mapping then second level lookup is performed.
The second level of cache is computer. One can get the caching details from 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 internet service provider (ISP) side.