3 Steps to Optimizing Application Performance with Multi-CDN - REGISTER NOW!

CNAME, ALIAS, and Linked Records

There are a lot of good reasons to create a DNS record that has no answer itself, but instead points to another record. Most often you do this when you want to ease maintenance by doing complex configuration in one place then referencing it elsewhere, or you’re required to do so to make use of another service (e.g. a CDN). In the common DNS spec, you’ll normally use CNAME records for this purpose.

In NS1, there are several additional ways to point one DNS record at another, each optimized for particular use cases. Knowing which to use and why can sometimes be a challenge. Here’s a rundown of the various ways to add a layer of indirection to your DNS records.

Some lingo we make use of here:

Source: The indirect record (CNAME, ALIAS, or Linked); the pointer
Target: The end result; the thing that gets pointed to
Advanced Configuration: NS1 specific record configuration such as Filters or Metadata
Zone Apex: The domain name that the SOA record refers to; the zone itself with no further hostnames attached; the “naked” or “root” domain; e.g., example.com

CNAME

Use when: You need simple indirection via referrals
Don’t use when: The Source is the Zone Apex, or when the Target is in a different zone in NS1 and has Advanced Configuration
Source Record Type: CNAME, part of DNS specification
Target Record Type: Any (typically A or AAAA)
Query Result: a CNAME record, possibly also the Target record if Target is in same zone
Chaining Allowed? Yes
Can point to domains outside NS1? Yes

CNAME is the most well known way to “symlink” one DNS record to another. It works by answering queries asking for the Source with a simple referral (by domain name) to the Target, which may be anywhere else on the internet.

If the Target exists in the same zone, NS1 will automatically add the Target answer to the query result, eliminating additional round trips. Otherwise, full CNAME resolution may involve the DNS recursor making additional requests.

When queried, a CNAME will always include a CNAME record in the response, and (as described) may also include the resolved record pointing to the Target (typically an A or AAAA record).

The biggest problem with CNAME is that (according to the DNS RFC) it cannot be used at the Zone Apex level. If you wish to point your Zone Apex to another record, use an ALIAS record.

DNAME records essentially make a CNAME record for every subdomain of a domain, and point it to another. For instance, a DNAME on domain.com pointed to example.com will link blog.domain.com to blog.example.com, www.domain.com to www.example.com, a.b.c.d.domain.com to a.b.c.d.example.com, and so on. It however will not link domain.com to example.com, you would need to use an A, AAAA, or ALIAS record for that purpose.

ALIAS

Use when: You want the functionality of a CNAME, but need it at the Zone Apex
Don’t use for: Non Zone Apex records
Source Record Type: NS1 specific pseudo-record, not in DNS specification
Target Record Type: A or AAAA
Query Result: one or more A or AAAA records
Chaining Allowed? Yes (inefficient)
Can point to domains outside NS1? Yes

ALIAS is a pseudo-record that works like a CNAME but can be safely used at the Zone Apex because it always resolves to A (or AAAA) record(s).

Resolution to the Target is a completely internal process; DNS recursors making the query will not be able to tell between an ALIAS record and a “real” A (or AAAA) record.

When queried, an ALIAS record will always return one or more A or AAAA records. Since ALIAS is a pseudo-record, the query result will never contain ALIAS.

There is no compelling reason to use an ALIAS record outside of the Zone Apex. Since it requires an extra external lookup, it can be slower than a CNAME or a Linked Record.

Linked Records

Use when: You want to reuse an existing NS1 record that has Advanced Configuration
Source Record Type: Any
Target Record Type: Any (but Source and Target must be same type)
Query Result: Whatever record type and number of answers the Target has
Chaining Allowed? Yes
Can point to domains outside NS1? No

Because NS1 allows for advanced record configuration far beyond traditional DNS records, it can be a burden to maintain identical Advanced Configurations across multiple records. To alleviate this, use a Linked Record to tell the NS1 authoritative server that it should use the full configuration from the Target record which exists elsewhere on the NS1 platform. The Target record does not need to be in the same zone as the Linked Record. For example, a CDN using NS1 can tell its customer, also using NS1, to use a Linked Record to point the customer’s domain at the CDN, instead of a CNAME -- eliminating DNS round trips and (for A or AAAA records) allowing direct resolution at the Zone Apex.

A Linked Record can be any record type (A, MX, CNAME, etc), but it must be the same type as the Target or it will not resolve. 

When compared to a CNAME, a Linked Record will typically require one less DNS lookup, often shortening the response time for the requesting resolver or user to receive the final answer.

Linked records are specific to NS1, and their resolution is a completely internal process. During resolution, the full configuration from the Target record (including Advanced Configuration) is simply duplicated into the Source record such that (apart from record name) they resolve identically. DNS recursors making the query will not be able to tell between a linked record and the “real” Target that it points to.

Linked records take full advantage of all features of the NS1 platform that are used by the Target record, including real-time Data Feeds.