Kaigai Blog living abroad in my twenties

【My Study Note】Resource Record Types

Infotech Networking

Resource Record Types


DNS in practice operates with a set of defined resource record types. These allow for different kinds of DNS resolutions to take place. There are dozens of different resource record types defined, but a lot of them only serve very specialized purposes.

A Record

The most common resource record is known as an A record. An A record is used to point a certain domain name at a certain IPv4 IP address.

In the most basic use, a single A record is configured for a single domain name. But, a single domain name can have multiple A records, too.

つまりは、結構アクセスを稼ぐような大きなサイトでは、1つのIP Addressだとアクセスが集中しすぎるから、1つのドメイン名に複数のIP Addressを紐付けている。

This allows for a technique known as DNS round robin to be used to balance traffic across multiple IPs.

Round robin

Round robin is a concept that involves iterating over a list of items one by one in an orderly fashion. The hope is that this ensures a fairly equal balance of each entry on the list that’s selected.

Example of A Record

Let’s say we’re in charge of a domain name www.microsoft.com. Microsoft is a large company and its website likely sees a lot of traffic.

To help balance this traffic across multiple servers. We configure four A records for www.microsoft.com at the authoritative name server for the microsoft.com domain. We’ll use the IPs 10.1.1.1, 10.1.1.2, 10.1.1.3, and 10.1.1.4.

When the DNS Resolver performs a look-up of www.microsoft.com, all four IPs would be returned in the order first configured: 10.1 1.1, followed by 10.1.1.2, followed by 10.1.1.3, and finally, 10.1.1.4.

The DNS-resolving computer would know that it should try to use the first entry, 10.1.1.1, but it knows about all four just in case a connection to 10.1.1.1 fails.

The next computer to perform a look-up for www.microsoft.com would also receive all four IPs in the response, but the ordering will have changed. The first entry would be 10.1.1.2, followed by 10.1.1.3, followed by 10.1.1,4, and finally, 10.1.1.1 would be last on that list.

This pattern will continue for every DNS resolution attempt, cycling through all of the A records configured and balancing the traffic across these IPs.

That’s the basics of how DNS round-robin logic works.

Quad A record

Another resource record type that’s becoming more and more popular is the Quad A record. A Quad A record is very similar to an A record except that it returns in IPv6 address instead of an IPv4 address.

CNAME record

The CNAME record is also super common. A CNAME record is used to redirect traffic from one domain to another.

Let’s say that Microsoft runs their web servers at www.microsoft.com. They also want to make sure that anyone that enters just microsoft.com into their web browser will get properly redirected.

By configuring a CNAME record for microsoft.com that resolves to www.microsoft.com, the resolving client would then know to perform another resolution attempt, this time for www.microsoft.com, and then use the IP returned by that second attempt.

つまりは、microsoft.comって打っただけで、www.microsoft.comにアクセスできる。まあmicrosoft.comは正式名称に対するあだ名的な感じ。わざわざ正式名称を打たなくてもredirectしてくれる。

CNAMEs are really useful because they ensure you only have to change the canonical IP address of a server in one place. In fact, CNAME is just shorthand for “Canonical NAME”. (複数のドメイン名に対して1つのIP addressを使えるってこと)

If we look again at our original example of making sure that visitors to both microsoft.com and www.microsoft.com get to the same place. We could do this in two ways.

First way

We could set up identical A records for both microsoft.com and www.microsoft.com domain names, and this would work just fine. But if the underlying IP address ever changes, we need to change it in two places. The A records for both microsoft.com and www.microsoft.com.

Second way (More useful)

By setting up a CNAME that points “microsoft.com” at “www.microsoft.com”, you’d only have to change the A record for www.microsoft.com. And you’d know that clients pointing at either domain would get the new IP address.

This might not seem like a huge deal with just two records to worry about, but large companies with complex presences on the web might have dozens of these kinds of redirections. It’s always easier to only have one source of truth.

MX record

Another important resource record type is the MX record. MX stands for mail exchange and this resource record is used in order to deliver e-mail to the correct server.

Many companies run their web and mail servers on different machines with different IPs, so the MX record makes it easy to ensure that email gets delivered to a company’s mail server, while other traffic like web traffic would get delivered to their web server.

SRV record

A record type very similar to the MX record is the SRV record. SRV stands for service record, and it’s used to define the location of various specific services.

It serves the exact same purpose as the MX resource record type except for one thing, while MX is only for mail services, an SRV record can be defined to return the specifics of many different service types.

For example, SRV records are often used to return the records of services like CalDAV, which has a calendar and scheduling service.

TXT record

The text record type is an interesting one. TXT stands for text and was originally intended to be used only for associating some descriptive text with a domain name for human consumption.

プログラミング言語でいうコメントと同じ感じやと思う

The idea was that, you could leave notes or messages that humans could discover and read to learn more about arbitrary specifics of your network.

But over the years as the Internet and services that run on it have become more and more complex, the text record has been increasingly used to convey additional data intended for other computers to process.

Since the text record has a field that’s entirely free form, clever engineers have figured out ways to use it to communicate data not originally intended to be communicated by a system like DNS.

This text record is often used to communicate configuration preferences about network services that you’ve entrusted other organizations to handle for your domain.

For example, it’s common for the text record to be used to convey additional info to an email as a service provider, which is a company that handles your email delivery for you.

現在、DNSのTXTレコードの最も重要な2つの用途は、電子メールのスパム防止とドメイン所有者の確認

There are lots of other DNS resource record types in common use like the NS or SOA records which are used to define authority information about DNS zones.

Useful image to understand what the dns record type is


Source: itfreetraining