# DNS records – Multiple A records vs. CNAME records

**URL:** <https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245>\
**Category:** Factual Questions\
**Created:** [April 15, 2010, 7:36pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245 "2010-04-15T19:36:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JimOfAllTrades](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@JimOfAllTrades](https://boards.straightdope.com/u/JimOfAllTrades)\
**Post date:** [April 15, 2010, 7:36pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/1 "2010-04-15T19:36:42Z")

</div>

I’ve been using Network Solutions as my domain registrar since it was the _only_ registrar.

Recently, one of my customers wanted to register several domains that they won’t be using for a while, and having heard good things about GoDaddy, I decided to create an account there and try them out on these new domains.

One difference I see is that when you start a new domain with Network Solutions, they default to multiple A records (www, @, \*) and no CNAME records, where GoDaddy seems to default to just one A record (@) and then has several default CNAME records (WWW, mail, FTP, etc) where several of them point to the @ A record.

Is there an advantage one way or another? Is it better to have one A record and a CNAME record for www that points to it, or two A records, one @ and one www?

I’ve never really used CNAME records, and now wonder if I’m missing something.

---

<div class="post-metadata">

**Author:** ![Caldazar](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Caldazar](https://boards.straightdope.com/u/Caldazar)\
**Post date:** [April 15, 2010, 7:48pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/2 "2010-04-15T19:48:14Z")

</div>

The advantages of CNAME records are that you can:

-Quickly change the IP address for a group of records; you just change the IP of the A record instead of all the records  
-Point your record to a zone entry you don’t control (e.g. [www.mydomain.com](http://www.mydomain.com). IN CNAME [www.someotherdomain.com](http://www.someotherdomain.com).)

The disadvantage is that resolving CNAME records to IP addresses requires two lookup operations instead of one, putting a heavier load on the DNS server.

---

<div class="post-metadata">

**Author:** ![goldmund](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@goldmund](https://boards.straightdope.com/u/goldmund)\
**Post date:** [April 15, 2010, 7:49pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/3 "2010-04-15T19:49:13Z")

</div>

> [@RJKUgly](#):
>
> I’ve been using Network Solutions as my domain registrar since it was the _only_ registrar.
> 
> Recently, one of my customers wanted to register several domains that they won’t be using for a while, and having heard good things about GoDaddy, I decided to create an account there and try them out on these new domains.
> 
> One difference I see is that when you start a new domain with Network Solutions, they default to multiple A records (www, @, \*) and no CNAME records, where GoDaddy seems to default to just one A record (@) and then has several default CNAME records (WWW, mail, FTP, etc) where several of them point to the @ A record.
> 
> Is there an advantage one way or another? Is it better to have one A record and a CNAME record for www that points to it, or two A records, one @ and one www?

There’s not going to be any difference an end-user can see. It’s mostly down to how you choose to organize things. I prefer having only one A record per IP address, and have a proper PTR record associated with the IP, matching the A record. Then any other aliased names would use CNAME records. This can simplify management of IP addresses.

CNAMEs can also be useful in cases such as dynamic DNS, e.g. you’d like to point your own hostname at a [dyndns.org](http://dyndns.org) hostname. That way your CNAME does not have to be updated as the IP changes.

Functionally, a CNAME will result in one extra DNS lookup, as it will first resolve into the real name, and then do another lookup to resolve this to an IP address (unless this is cached). This isn’t really a practical concern performancewise nowadays.

One thing to note, and a possible reason Network Solutions configures things the way they do, is that you cannot have a CNAME along with another entry for any particular hostname. For example:

host1 IN CNAME [somehost.example.com](http://somehost.example.com).  
host1 IN MX 10 [mailhost.example.com](http://mailhost.example.com).

This is not valid, and would result in an error. This is the main, practical “gotcha” to watch out for when choosing whether or not to use CNAMEs.

> [@RJKUgly](#):
>
> Is there an advantage one way or another? Is it better to have one A record and a CNAME record for www that points to it, or two A records, one @ and one www?
> 
> I’ve never really used CNAME records, and now wonder if I’m missing something.

They’re probably trying to avoid confusion to the aforementioned limitation. In many cases I’d want something like:

mail IN A 10.0.0.1  
www IN A 10.0.0.2  
@ IN CNAME [www.example.com](http://www.example.com).  
@ IN MX 10 [mail.example.com](http://mail.example.com).

The thinking being you want mail to go to one host, web traffic to another, but don’t want to assign an IP address to “[example.com](http://example.com)” by itself. Unfortunately that does not work, and you need to do:

@ IN A 10.0.0.2  
@ IN MX 10 [mail.example.com](http://mail.example.com).  
mail IN A 10.0.0.1  
www IN CNAME [example.com](http://example.com)

The first way seems more intuitive to a lot of people, and it’s possible they’re trying to steer folks toward the second way to avoid that situation.

---

<div class="post-metadata">

**Author:** ![JimOfAllTrades](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@JimOfAllTrades](https://boards.straightdope.com/u/JimOfAllTrades)\
**Post date:** [April 15, 2010, 10:23pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/4 "2010-04-15T22:23:35Z")

</div>

Thanks, both **Caldazar** and **teletype** , I’m going to have study that a little bit and make sure I understand.

One other question, it is true that if I have an MX record that points to a host name on my domain, (e.g. MX 10 [mail.example.com](http://mail.example.com). where [example.com](http://example.com) is the domain) I must have an A record for that same host name (e.g. mail IN A 10.0.0.1), is that correct?

I’ve always done it that way, and it seems this is one time when you have to have multiple A records, if your mail server is at a different IP address than your main domain.

---

<div class="post-metadata">

**Author:** ![dasgupta](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dasgupta](https://boards.straightdope.com/u/dasgupta)\
**Post date:** [April 16, 2010, 4:35pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/5 "2010-04-16T16:35:04Z")

</div>

> [@RJKUgly](#):
>
> One other question, it is true that if I have an MX record that points to a host name on my domain, (e.g. MX 10 [mail.example.com](http://mail.example.com). where [example.com](http://example.com) is the domain) I must have an A record for that same host name (e.g. mail IN A 10.0.0.1), is that correct?

That’s correct. The MX record must contain an FQDN and not an IP address, so MX 10 10.0.0.1 is invalid. And you would need an A record for the FQDN you specified, as you said.

> [@](#):
>
> I’ve always done it that way, and it seems this is one time when you have to have multiple A records, if your mail server is at a different IP address than your main domain.

You would have multiple A records for each different physical host, adapter or IP. If you have three hosts each with their own IP (or 1 host with three IPs), you would need at least one A record for each under normal conditions. This could be common for an organization that hosts multiple servers - say web, mail and FTP all on separate machines or at separate locations.

Also, many organizations have redundant mail servers, each with an MX record of a lower priority, so that’s an additional A record per.

For example, at my company we have four public websites, all externally hosted at the same IP (one A record, three CNAME). We have our webmail, hosted locally. We also have 2 MX records at different IPs than our webmail; finally a few employee-only sites. All in all, 6 A records.

---

<div class="post-metadata">

**Author:** ![JimOfAllTrades](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@JimOfAllTrades](https://boards.straightdope.com/u/JimOfAllTrades)\
**Post date:** [April 16, 2010, 11:00pm UTC](https://boards.straightdope.com/t/dns-records-multiple-a-records-vs-cname-records/536245/6 "2010-04-16T23:00:08Z")

</div>

> [@dasgupta](#):
>
> That’s correct. The MX record must contain an FQDN and not an IP address, so MX 10 10.0.0.1 is invalid. And you would need an A record for the FQDN you specified, as you said.

Thanks, that does fit with what I was thinking, I just wanted to be sure I wasn’t missing anything.

> [@dasgupta](#):
>
> For example, at my company we have four public websites, all externally hosted at the same IP (one A record, three CNAME). We have our webmail, hosted locally. We also have 2 MX records at different IPs than our webmail; finally a few employee-only sites. All in all, 6 A records.

Very similar to what I run for myself and my customers. Several websites, FTP sites, and two different mail servers spread out across four physical servers. So in almost every domain I set up, I have one or two MX records pointing to different FQDNs, plus A records for the “mail” and “mail2” hosts (that’s what I always call them, not original but WTH), plus A records for the www and FTP hosts..

I’ll have to look at using CNAME records for the www and FTP host names in those cases where they run off the same server and IP address.

Interesting.
