DNS Tutorial | How the Domain Name System works.

0

Today I thought I would give a basic overview of how the Domain Name System (DNS) works and explain a bit about the most common record types in DNS. There is a lot more detail to DNS that I will not be covering in this tutorial (books have been written on DNS), but this is a good place to start to gain a basic understanding of the system.

DNS is a core concept of the internet and networks in general that is extremely important for the proper functionality of almost any system that need to communicate on a network. It is also important to help humans navigate the internet and access network resources because we are not great at remembering IP addresses. It is much easier to type into a web browser (and remember!) https://www.linfrastructure.net than it is to type https://172.64.80.1.

The Basics

DNS stands for Domain Name System. It is a system (many, many systems) that ‘resolve’ a human friendly domain or host name to a computer friendly IP address. This is done by ‘querying’ the DNS server that you have configured on your computer and asking it to resolve a host name to an IP address, so your computer can access the resource that you have requested.

Below is a very basic example of how this works. We will take a bit of a deeper dive into the inner workings of this process later.

As you can see above, when you type in a domain name, such as www.google.com into a browser, your computer requests that the host name (www) and domain name (google.com) be resolved to an IP address that your computer can use to find the web server and load the page.

You can think of an IP address as a physical address that you may use to navigate to someones house. It is unique to the persons house and can be used to get you from one place to another. Computers use IP addresses to find resources on a network or the Internet. Since remembering IP addresses is difficult, DNS was developed to allow for a mapping of a name to an IP address as well as a means for computers to look up the address from the name, similar to a phone book or directory.

More detail on DNS

As I mentioned above, the depiction of how this works is rather basic. Below is a more detailed version that outlines how typical name resolution would work.

As you can see above, DNS typically consists of many server types, responsible for different levels of the naming hierarchy.

Server TypeDescriptionServer Function
ResolverThis is the server that is closest to the user and configured as the name server on your computer. This can be a name server operated by your ISP or a public name server, such as Google’s public name servers (8.8.8.8 and 8.8.4.4).This server performs the initial resolution of a name and caches records that are looked up frequently by the user. It is typically fast as it has a large number of users, and therefore a large number of cached records.
Root HintsThis server contains records that give a resolver a ‘hint’ as to where to find TLD and Authoritative name servers on the Internet.Host and provide hints to let other name servers in the DNS system where to find a DNS server with more detailed records.
TLD Name ServerA TLD (Top Level Domain) is responsible for records within that TLD and typically hosts NS records for authoritative name servers for domains within that TLD (.COM in this example). Host and provide resolution for name servers that serve individual domain names, such as google.com.
Authoritative Name ServerThis server holds the records and is ‘authoritative’ for an individual domain, such as google.com as well as any host records that domain may have defined, such as ‘www’ (www.google.com) or ‘mail’ (mail.google.com)Hosts all DNS records that belong to a specific domain. This is where the systems administrator configures individual records to point to resources within the domain for which these servers are authoritative.

Common DNS records

Records are the actual name to IP address mappings that are created by people and are stored on DNS servers to answer requests by computers and other servers. There are many more record types than the ones I have below, but these are some of the most common records that you will find/configure in your DNS servers.

Record TypeDescriptionPurpose
AAn (A) record is a record that represents a host or domain and is used to resolve the domain or host name to an IP address. It is known as an ‘Address’ record.An (A) record is generally created to point a name to an IP address. An example is the (A) record for linfrastructure.net and www.linfrastructure.net. These are 2 individual records. One for the domain (linfrastructure.net) and one for the host name (www). The records point to the web server IP address that this site is hosted on – 172.64.80.1 in this case.
AAAAAn (AAAA) record is the same thing as an (A) record but it is used to point to IPv6 addresses, rather than IPv4 addresses. It is also known as an ‘Address’ record.An (AAAA) record is generally created to point a name to an IPv6 address. I do not use IPv6 for my web site, so I do not have an (AAAA) record pointed at the server hosting this site.
CNAMEA (CNAME) record is an alias that points one domain or host name to another. It is known as a ‘Canonical Name’.I have another domain called 954network.com that has a (CNAME) record pointed to the domain linfrastructure.net. This allows my server to accept requests and serve the same site for both domain names.
MXAn (MX) record is used to tell mail servers where to find the IP address of a mail server that sends and receives email for a domain. It is known as a ‘Mail Exchanger’ record.The domain linfrastructure.net has multiple (MX) records with varying priority that point to the mail servers responsible for sending and receiving email for @linfrastructue.net email addresses.
NSAn (NS) record is used to let other name servers, such as TLD servers where to find the DNS server(s) that are responsible (authoritative) for a given domain name. It is known as a ‘Name Server’ record.The domain linfrastructure.net has multiple (NS) records that point to the IP addresses for DNS servers that are authoritative for my domain. These servers are where all of the DNS records outlined here are defined.

Conclusion

Now you should have a basic understanding of DNS, why it is important, how it works and what types of records you will typically see and configure on your own DNS servers. As I have mentioned throughout this tutorial, this is a very basic overview. DNS is a very complex system with much more functionality (such as zones, zone transfers, DNSSEC and more) that is in a way, the backbone of the modern Internet and network in general. There are a lot of resources on the internet such as white papers that explain how this works in much more detail. If you are interested in learning more about how DNS works, I recommend the following resources to get started.

RFC-1035 | Domain Names – https://www.ietf.org/rfc/rfc1035.txt

Wikipedia | Domain Name System – https://en.wikipedia.org/wiki/Domain_Name_System

Leave a Reply