Enchanted Code

01 - What Is DNS?

2 minutes read

Intro

This tutorial will introduce what the “Domain Name System” (DNS) is and why we use it. Using website access as the primary example.

Why Use DNS?

At the core of networking devices use IP addresses to refer to specific servers. However, from a users perspective remembering an address such as 192.168.12.20 is not a good experience, since a user would have to remember what site each address refers to. It also would limit us to serving a single site for that IP address on standard web ports.

DNS allows us to map a more friendly name to an IP address called a “Fully Qualified Domain Name” (FQDN). For example, instead of a user typing 192.168.12.20 into a browser; the domain name example.com could instead be used.

How It Works?

If we wanted to access a site on our web browser, before our browser can know where to send our request it will first have to lookup where to domain is pointing to.

Using DNS the browser will send a DNS query to a DNS resolver, which is a server that will handle DNS queries. This server is generally configured in the network settings of the computer.

There are several different types of records we can request from a DNS server. Since we want to translate a domain name into an IP address we would make a query for a A or AAAA record, these two records are for getting IPv4 and IPv6 addresses.

NOTE: There are many more record types, however these will not be covered in this tutorial.

After we have received the address our browser can then start the web request for the page contents.

DNS Query Example

Conclusion

To conclude, when we type in a domain name into a web browser it will make a DNS query to a DNS resolver; which will contain the domain name to lookup and what type of record we want, in this case it will either be an A or AAAA record. The DNS server will then return back the IP address if one was found. After this the web browser can send the actual request using the discovered address and get the web page contents.

See Also

Buy Me A Coffee