[CentOS] DNS wizard

Fri Dec 30 04:47:19 UTC 2005
Les Mikesell <lesmikesell at gmail.com>

On Thu, 2005-12-29 at 21:43, John Hinton wrote:

> I've almost never use CNAMES and really am wondering about a truly 
> useful application. In this day of spam, it seems like less is best with 
> regards to subdomains, such as the example above. CNAMES also require at 
> least one extra loop in the lookup.. so why are they so widely used when 
> an A record does the more defined and more limited task? There certainly 
> seems to be some useful wizardry in CNAMEs, but darned if I can think of 
> a use for basic web hosting types of situations.

There are a couple of reasons.  First it is a good idea to give
different DNS names to different services (ftp, www, mail, etc.)
from the start even if they are originally hosted on a single
box.  Then if you have some reason later to move a service to
a different machine, all you have to do is make that CNAME
point there and you don't have to notify any clients.

Another case is where you want a name to appear in your
domain, but it is really a host managed by someone else.
In this case you can CNAME to his dns name and not need
to be aware if he subsequently changes the IP address.

In the web world, you might have hosts at several locations
for load balancing and redundancy and multiple A records
with the same name.  Then you might run many sites on
all of these servers as named virtual hosts.  This is
much easier to manage if you have a single stack of

realhost IN A  ip.address.1
realhost IN A  ip.address.2
realhost IN A  ip.address.3
etc.

and then one CNAME per vhost
(these would each be in their own domain zone file)
www.domain1.com IN CNAME realhost.realdomain.com.
www.domain2.com IN CNAME realhost.realdomain.com.
www.domain3.com IN CNAME realhost.realdomain.com.

When you look up one of the CNAMEs, you get all the A records so the
load balances across them.  If you need to change the real servers
or take one out of service, you only have to do it in one place.

-- 
   Les Mikesell
    lesmikesell at gmail.com