DNS as the name says DOMAIN NAME SYSTEM , it is the system designed to resolve the Domain Names like “www.google.com.” to its IP address (18.104.22.168). Domain Name is a Unique Identifier.
Try PING command in your command prompt ” ping www.google.com. -4 ” to check the IP (IPv4) address.
Type “www.google.com” in search bar of your browser.
Type 22.214.171.124 in search bar of your browser. HURREY ! you get the same result.
Note : In case of Shared(Virtual Hosting), a single IP address points to multiple sites on a single server. So, when you type IP address of the Website, it will not be resolved to the Domain Name. And if the IP address is protected by CloudFlare, we can’t access it with IP address.
Little Overview About Domain and Hosting
Once we bought a Domain (Name) for our Website from a Domain Registrar like godaddy. We need someone with a server who could run our website with our Domain Name on the Internet and everyone can access the services you provide. So, you buy a server which meet your requirements. Websites/Web apps are hosted on Linux/Windows Servers according to the plan you choose from your hosting service providers. Once you have paid it will take approximately 3-4 hours. You will be able to configure Domain Records through your Domain Name Registrar’s platform and then it will pass the information to ICANN.
When you purchase the Server for hosting your website, they will give you a specific set of IP (Internet Protocol) address. This IP address will point to your website and it will be accessible on the Internet.
Need Of Domain Name System
There are over 1.5 billion websites on the world wide web as of January 2018. All those websites are identified by their respective IP addresses. When you type “www.google.com.” in your browser search bar , how will your browser locate your website because there is no direct LAN cable attached to the server on which your website is hosted (technically we do not need to write the name of website, if we know the IP address) . So your browser will locate websites by their Server IP address.
Machine talks with numbers (IP addresses) but Humans talks with Names. It is easier for us to remember Names. That’s why we need a system which could identify IP addresses for different websites and fill the gap between Machines and Humans. That’s how the Network Engineers came up with the Idea of DNS.
Working Of DNS
DNS works like a Phone Book. When we want to find a number. We look for Names first then it will give you the Name. Here replace number by IP address and Name with Domain Name.
When you type “google.com” in your web browser, it will check in your local cache memory. If there is no record, then it will send the query to next level called as Resolver Server to resolve the Domain Name to IP address. If there is no luck, Resolver send the query to ROOT server. There are 13 different root servers placed all around the world strategically operated by 12 different Organizations. Check ROOT DNS SERVERS here.
Root Server doesn’t know the IP address. But it does know where to redirect the Resolver Server. So, it sends a referral and redirect to the TLD(Top Level Domain) server, TLD Servers stores the address information for Top Level Domains such as .com, .net, .org. TLD severs doesn’t know the IP address of google.com. domain. So TLD servers send referral and redirect the Resolver to Authoritative Name Servers.
Resolver will ask for the IP address of google.com. So Authoritative Name servers sends back record to the Resolver. Resolver caches that record. And we access the google web server with that IP.
Steps involved In DNS Query
- Local Cache (type “ipconfig /displaydns” in command prompt)
- Resolver Server (basically your ISP checks in its cache memory,query ROOT Server)
- Root Server ( Top of the DNS Hierarchy, redirect to TLD server)
- TLD Server (Top Level Domain, Ex = .com , .net , .edu, redirect to Final Level i.e., Authoritative Name Server)
- Authoritative Name Server (Ex = del03s06-in-f4.1e100.net )
- Resolver Server (Query for IP address and receive it, Record Cached,Done)
Once Resolver Server gets the IP address, it stores the IP address in its cache memory. So it doesn’t have to perform all the steps again if it receives the DNS query for same website.
DNS query uses protocol which runs on UDP port 53.
We can configure DNS in two ways.
- DNS Client ( resolver )
- DNS Server
DNS configuration via DNS Client are listed below.
Windows Users : open command prompt / powershell
- type ” ipconfig /displaydns ” to display local DNS cache Records.
- type “ ipconfig /flushdns ” to clear the local DNS cache Records.
Linux/Unix Users : open terminal
- type ” cat /etc/resolv.conf ” to view local DNS cache Records.
- type ” nano /etc/resolv.conf ” to edit local DNS cache Records.
Click here to configure DNS Server on Linux, for Windows you need to download and install windows server.
Click here to know more about DNS Configuration files.
The other way to update DNS records is hosts file. Navigate to “C:\Windows\System32\drivers\etc ” and open the hosts file in Notepad with admin privileges and you can add the entries like given below. It will automatically update the DNS records.
Ex : nameserver 126.96.36.199
Now if there is no match in local DNS cache, you can configure DNS servers by navigating to Network Settings. Here is how to configure your machine to use OpenDNS.
Test DNS LEAK here. If you are concerned about privacy. Do not use your ISP’s DNS servers. Default settings use your ISP’s DNS servers. And if you are using VPN’s, your DNS queries are still monitored and recorded by your ISP( Internet Service Provider).
IF YOU HAVE ANY QUESTION, please let us know in comment section below.