Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

*.mydomain.com - A record or CNAME?

Some people are saying use an A record and others a CNAME for a catch all subdomain.

Which should I use and why?

like image 475
Igor K Avatar asked May 18 '10 21:05

Igor K


People also ask

Should I use CNAME or a record?

General rules: Use an A record if you manage which IP addresses are assigned to a particular machine, or if the IP are fixed (this is the most common case). Use a CNAME record if you want to alias one name to another name, and you don't need other records (such as MX records for emails) for the same name.

Is subdomain a record or CNAME?

A CNAME record is an alias for a subdomain. When you configure a CNAME record for a subdomain, DNS queries are no longer sent for the subdomain but for the domain or subdomain specified in the CNAME record to the appropriate name server.

What is a CNAME example?

CNAME stands for Canonical Name. A common example is when you have both example.com and www.example.com pointing to the same application and hosted by the same server. To avoid maintaining two different records, it's common to create: An A record for example.com pointing to the server IP address.

What is an NS record in DNS for example in Mydomain com?

NS represents the DNS record type. ns1.mydomain.com represents the value of the record. That is the nameserver for that domain. 3600 is TTL (time to live).


1 Answers

I think question is about to understand A & CNAME records deeply. I have also found this confusing but after reading couple of blogs, I came up with following understanding:

The A and CNAME records are the two common ways to map a host name (name hereafter) to one or more IP address. Before going ahead, it’s important that you really understand the differences between these two records. I’ll keep it simple.

The A record points a name to a specific IP. For example, if you want the name blog.myweb.com to point to the server 186.30.11.143 you will configure:

blog.myweb.com     A        186.30.11.143 

The CNAME record points a name to another name, instead of an IP. The CNAME source represents an alias for the target name and inherits its entire resolution chain.

Let’s take our blog as example:

blog.myweb.com              CNAME   my.bitbucket.io my.bitbucket.io             CNAME   github.map.mybitbucket.net github.map.mybitbucket.net  A       186.30.11.143 

We use GitHub Pages and we set blog.myweb.com as a CNAME of my.bitbucket.io, which in turns is itself a CNAME of github.map.mybitbucket.net, which is an A record pointing to 186.30.11.143. This means that blog.myweb.com resolves to 186.30.11.143.

Conclusion:
A record points a name to an IP. CNAME record can point a name to another CNAME or an A record.

Source:
Differences between A & CNAME records

like image 139
Aamir Avatar answered Oct 11 '22 11:10

Aamir