HOW DNS WORKS
Posted on: Friday, December 28, 2018
DNS or Domain Name Servers are the equivalent of a phone book for the internet. They maintain a list of domain names and translate them to internet protocol(IP) address so browsers can load internet resources. It is similar to where you know the name of your friend but you do not know his or her telephone number, so if you want to contact your friend, you have to look his name on the phone book and dial his number.
Each device has a unique IP, each machine on the internet find each other using their IP address. The DNS server which is the mapping of the IP address to a more friendly website name eliminates human to remember the IP address of each website instead of the website name. Hence, it easier to remember the hostname such as www.terabit.ca instead of the IP address. DNS will translate what you typed in your browser to the corresponding IP address. When you visit www.terabit.ca, a series of steps happens behind the scene to translate the human-readable web address to a machine-friendly IP address.
Steps in a DNS lookup
- User enter www.terabit.ca in chrome, first your computer look the local DNS cache. This cache store information that recently visited IP address and the corresponding hostname
- If the local DNS cache does not have the information, the DNS query will be issued via the internet, it will be received by DNS recursive resolver. The DNS recursive server designed to receive queries from client machines through applications such as web browsers. The resolver has their own cache, and most often the most popular domain names are already in the cache. If that is the case, the process will end here and the information will be returned to the client
- If the information is not found inside the DNS recursive resolver cache, then the resolver query a DNS root name servers. A name server is a computer that answers a question about IP addresses.
- The root servers respond to the resolver with the address of the Top-level Domain(TLD). The root server will read from left to write. For instance, for www.terabit.ca, the root servers direct the query to the TLD for .ca. Each TLD such for .com, .org has its own set of name servers
- The resolver makes a request to the .ca TLD. TLD DNS names store the address information for second level domain terabit.ca. The TLD server also answers the IP address of the domain name server which provides the next piece of the puzzle
- The recursive resolver sends the query to the DNS which knows the IP address of terabit.ca
- Finally, the recursive resolver knows the IP address for the terabit.ca which tell the browser what the IP address is. The browser can request to the website to retrieve the website content using the IP address.
This entire process takes only milliseconds to complete.