In a network, computers or devices are identified by numbers (IP address) instead of name. In contrast, humans are more familiar with names, instead of numbers. To bridge this, the engineers use DNS or Domain Name System. For example, if you want to visit this website, you would write binaryte.com instead of its IP address. DNS can be considered as “the phonebook of the internet”, as it will be much easier for us to look for the name (domain name), instead of the number (IP address).
How does DNS work?
The domain name system works in a hierarchical manner. At the beginning, if you look for another website, let’s say google.com, the client PC will request the DNS query on your own PC’s cache memory. If it can’t find anything, it will then request to the DNS server also known as resolver server.
Just like your PC, the resolver server will request the same query to its own cache memory for the website’s IP address that you have asked for. If it found nothing, it will forward the query to the next level server.
Root server (root or ”.“)
This server contains the records of TLD (Top Level Domain). When the queries enter the root server it will redirect to the TLD server for the website IP address.
TLD server (.com)
The TLD server contains the record of the domain. As the name goes, the TLD server contains the information of top level domains such as .com, .net, .org, etc. As our query is based on the .com, this server doesn’t know what google.com is. Therefore, it redirects to a more specific server.
Authoritative Name Server (google)
On the authoritative Name Server level, the query is specified for the IP address of google.com. As it is the most specific server, it is expected to know every query we have asked for. At this point the query will be responded back to the resolver server for the result of the query’s IP address. In the end, the resolver will let your PC know the IP address of your PC’s query and direct it to the webpage.
To increase data retrieval performance for the next query, the resolver server will cache the result to its own cache memory.
DNS Records
A and AAAA
The A record and AAAA record map the hostname with its respective IP address. What distinguishes between both is that A record maps the IPv4 address (e.g. 142.251.40.238) while the AAAA record maps the IPv6 address (e.g. 2607:f8b0:4006:80b::200e).
CNAME
CNAME maps alias name (canonical) to hostname. In concept, let’s say the CNAME (canonical name or alias) of foo.example.com is bar.example.com. When there is a client computer requesting for foo.example.com, the client will be directed to bar.example.com. For example, we can use gmail.com. As you requested gmail.com, you will be redirected to mail.google.com instead of gmail.com.
MX
MX or mail exchanger, is the record that tells you where the incoming email from sender to recipient will be traveled to. If an A record points out to the web server, the MX record points out to the mail server. The MX record also shows you the numbers representing the mail priority.
NS
NS or name server shows where all of your DNS records are stored. This record is provided by the domain registrar or hosting provider. The record would look like ns1.domain.com and ns2.domain.com. The provider commonly gives you two name servers.
TXT
Using TXT you can write everything you want. Whether telling what your website is all about and so on. The TXT record actually doesn’t do anything and text based entries.
Dynamic DNS
In the previous explanation, we know that when we request a website, the query from the client computer (DNS query) will be converted by the DNS server in the form of IP address. To be able to work properly, this IP address has to be static or must not change.
If this IP address changes, the DNS server database needs to be updated which is very time consuming. It would be a disaster for a company to have its website down for a whole day. This is the reason why the business website uses the static DNS. In contrast, DDNS (Dynamic DNS) uses dynamic IP addresses attained from DHCP server and it’s commonly used at home networks.
When using DDNS for a single PC, you can assign its name. By doing this, you can connect to your PC remotely using your custom name even if the IP address has always been changing. Even better, you can try to use this for hosting website on from your home server.
Conclusion
DNS or Domain Name System is a crucial component of the internet that allows us to access websites using names instead of numbers. In this article, we have explained how DNS works in a hierarchical manner, from the client PC to the root server, the TLD server, and the authoritative name server. We have also discussed some common types of DNS records, such as A, AAAA, CNAME, MX, NS, and TXT. Finally, we have introduced the concept of dynamic DNS, which enables us to use dynamic IP addresses for hosting websites or connecting remotely. By understanding the basics of DNS, we can appreciate its importance and functionality in various aspects of online communication.