What is DNS and How Does It Work?

DNS is the backbone of the internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.

An IP address is given to each device on the Internet, and that address is necessary to find the appropriate Internet device – like a street address is used to find a particular home. When a user wants to load a webpage, a translation must occur between what a user types into their web browser (example.com) and the machine-friendly address necessary to locate the example.com webpage.

Domain Name System Terminology

A domain name is a human-readable name—like amazon.com—that we type in a web browser URL field. The Internet Corporation for Assigned Names and Numbers (ICANN) manages  these domain names.

Top Level Domain (TLD)

TLD refers to the last part of a domain name. For example, the .com in amazon.com is the Top Level Domain. The most common TLDs include .com, .net, org, and .info. Country code TLDs represent specific geographic locations. For example: .in represents India. Here are some more examples:

  • com – Commercial businesses.
  • gov – U.S. government agencies.
  • edu – Educational institutions such as universities.
  • org – Organizations (mostly non-profit).
  • mil – Military.
  • net – Network organizations.
  • eu – European Union.

Second Level Domain

This is the part of a domain name which comes right before the TLD—amazon.com—for example.

Sub Domain

A subdomain can be created to identify unique content areas of a web site. For example, the aws of aws.amazon.com.

Domain Name Registrar

By managing domain name reservations, name registrars are critical to how DNS works. ICANN currently grants permission to organizations to act as domain name registrars for specific higher level domains.

Name Server

Like a phone book, the name server is a collection of domain names matched to IP addresses.

Domain Name System record types

How the DNS Works

When you submit your request for the domain ‘anydomain.com’ your browser first checks the local operating system for any entries of it.

Remember the “hosts” file we mentioned earlier? It’s still around and it’s the first place where the OS looks for IP addresses bound to that domain.

If it doesn’t find a reference in there, then the OS checks with your internet service provider.

This is the beginning of a process called DNS record lookup, as the ISP sends the request to the global network to locate the resource (website, typically) the end-user wants. Due to the amount of DNS lookups being performed for each provider (literally, millions per second), ISPs usually keep a cached version of the entries so they don’t have to make the lookups every single time the same resource is requested.

This step of the process is handled by the recursive resolverA noteworthy fact about the resolver is that it groups the requests it receives in batches. Essentially, this creates a cache database so that a small number of requests can serve a considerable amount of users. This saves network traffic, which is extremely important when we keep in mind the scale of the internet.

Main Types of DNS Records

A Record

The A record is a DNS record that relates a domain name to an IP address. This is how your website’s home server can be found on the internet. It is the A record that associates the website (the content) with its designated domain name (address).

AAAA Records

The AAAA records are exactly the same as the A records, but instead of using IPv4 addresses, they use IPv6, which is already a necessity. When the internet was created, the amount of 4 billion addresses provided by IP version 4 seemed orders of magnitude greater than what would ever be needed. However, with the exponential growth of the internet and the explosion of devices connected to it, this is no longer the case. IPv6 was introduced to battle the exhaustion of the IPv4 pool without changing much how DNS works as a whole.

CNAME Record

The CNAME record is quite similar to the A record, but it binds a domain name to another domain name. This way you can hook subdomains of your domain to external domains without worrying about changing their IP addresses – you will be referenced directly to the other domain name instead.

MX Record

The MX record is the one that directs where the mail server, and quite often “servers” are located. In order for your website to open, there needs to be a web server which serves the website data; however, the emails are sent and received by a mail server, hence the purpose of existence of the MX record.

MX records have a specific property called priority. The MX server priority is designated with digits, starting with zero. This is done for redundancy reasons, mostly, so that several mail servers can be associated with a single domain name. If the server with priority 0 doesn’t reply to the request, the one with the next number is being queried and so on.

SPF Records

SPF records is a TXT record (a text-based record) used for determining the authenticity of the mail services. As the mail protocol is quite old and hasn’t seen many (if any) updates over the last decades, additional security measures are introduced every now and again. Most of them help determine whether the sender of the email is the person he claims to be. SPF records are one of those mechanisms.

PTR records

PTR records are reverse DNS records which are the exact opposite of A records. They bind IPs to domains. This way when you query an IP, you can get meaningful information as to what domain name it’s associated with.

NS Records

The nameserver records are one of the most important ones as they tell the domain name which DNS zone to use. Generally, you can create a DNS zone in any DNS server and have different records for it. For example, you can create a valid DNS zone for “google.com” and send it to your website. Does this mean that all the traffic for Google is now yours? Well, no, because the authentic Google.com NS (nameserver) records are saying which exact nameservers are containing the correct DNS zone. Quite handy.

Today we looked at what is DNS and the principles of how it works. This article will act as handy for you on DNS management. As mentioned above, the role of DNS is to convert the domain names into IP addresses.

Leave a Reply

Your email address will not be published. Required fields are marked *