Can't make CNAME of base domain

If I have domain foo.bar, I am unable to specify a CNAME for foo.bar (no A record) - the error is that I am trying to create .foo.bar (note the initial dot).

I'm am trying to catch both www.foo.bar and foo.bar, pointing them to the same place. (This allows me to change just one record if my primary Linode goes down, to put everything I host onto my secondary.)

I was under the impression that it was possible to alias the base domain in this way - in fact I'm pretty sure that I've actually done it before through Zoneedit.

So, who's wrong - me or the software?

4 Replies

You should probably make "foo.bar" an A record with the desired IP. Then CNAME "www.foo.bar" to "foo.bar". However, the recommendation I've seen is to make them both A records, to prevent an extra lookup when people use the www name.

Thanks for your reply.

The issue here is that I have a large number of domains that might need to change IP at a moments notice - all from one single IP to another IP.

This is why I have a single A record, andreas.bar.baz. I then make all the www.foo.bar, www.bing.bong, www.niddle.naddle, etc., records point to andreas.bar.baz. Then, when the machine with the IP pointed to by andreas.bar.baz goes down big time, I just change the andreas.bar.baz A record (which should have a short TTL) to the IP address of my backup server. This means that I make ONE DNS change to get all my sites up on the other machine.

Very few of my domains really need A records as the www's CNAME to one host on another domain with MX records pointing to other hosts on that other domain.

Could it be that the way that way DNS is done is based on practices that have been since superseded?

In this day and age, I don't see two hits on my DNS per lookup being a big deal. Hey, I make up to three DNS hits on every mail coming into my system (DNSBL, SPF). So, I'm aware of the old thing of making both the bare domain and www.foo.bar have A records, but don't really think that it is as relevant on the modern Internet. (That's the Internet we've got at the moment, not the one that gets trashed by a hobo's discarded cigarette butt ;-)

@smiffy:

This is why I have a single A record, andreas.bar.baz. I then make all the www.foo.bar, www.bing.bong, www.niddle.naddle, etc., records point to andreas.bar.baz.

This is fine; you can do that. It works.

But what you can not do is have "bar.com" or "bong.com" or "naddle.com" be CNAMES for andreas.bar.baz - that won't work. www.bar.com, fine; bar.com no.

The domain needs to have an SOA record. You can't have a CNAME and other records at the same time.

If I was doing this on my own DNS server then I'd make all the zone files be the same file. eg

zone "bar.baz" {
        type master;
        file "mystuff";
};

zone "bleh.meh" {
        type master;
        file "mystuff";
};

And "mystuff" can contain an A record for the zone (@ IN A 1.2.3.4) and www IN A 1.2.3.4 so changing the DNS is simply changing one file and reloading the zones.

Thanks. Think I understand it now - I was dreading having to re-read "DNS and BIND" because I really didn't want to spend the weekend with a migraine ;-)

As I'm using the Linode DNS (and ZoneEdit elsewhere) rather than running my own, the file option isn't really open to me. Handy to know, though. One day when I'm feeling brave, I might consider setting up DNS on my two Linodes.

For now, I will just set up A records pointing to the IP of my primary Linode for the bare domains. My Web servers are set up to redirect the bare domains to the appropriate www. or whatever, so it would be no great problem if the bare domains pointed to non-operating IPs, as nobody should be using them anyway!

Thanks again for the clarification.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct