dog, the command-line DNS client

The CNAME record

The CNAME (canonical name) record aliases one domain to another.

Limitations of CNAME aliasing

Because the CNAME record works at the domain-name level, rather than the website level, it is only possible to alias one domain to another: you cannot necessarily alias one website to another.

For example, if your website is hosted at example.com, and you want to also make it available at example.net, you could CNAME one domain to another, and both would have your website on them. However, if your website was only available by going to example.com/mysite, then you cannot make the alias — there’s no way to add the /mysite path.

Example

Here, we query for CNAME records of the domain cname-example.lookup.dog. The result is a record pointing to another domain.

$ dog CNAME cname-example.lookup.dog
CNAME cname-example.lookup.dog. 1h00m00s   "dns.lookup.dog."

Use in A record queries

It’s possible for a CNAME record to be returned as the response to an A or an AAAA query, followed by the IPv4 or IPv6 address of the domain specified in the CNAME record.

$ dog A cname-example.lookup.dog
CNAME cname-example.lookup.dog. 1h00m00s   "dns.lookup.dog."
    A dns.lookup.dog.           1h00m00s   51.159.26.255