Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2000 14:31:56 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Matthew Joseff <mjoseff@hellenco.com>
Cc:        FreeBSD Questions List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: CNAME vs A records (clarification)
Message-ID:  <Pine.BSF.4.21.0003121408340.6666-100000@ren.sasknow.com>
In-Reply-To: <Pine.BSF.4.10.10003121426540.79357-100000@retribution.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Joseff wrote to FreeBSD Questions List:

> Can someone correct and/or confirm my understanding of CNAME vs A records:
> 
> CNAME should be used for a host that exists on (potentially) another
> server but uses that domain.

CNAME is a canonical name for a host.  From DNS and BIND 3.e., O'Reilly
p63:

	A CNAME record maps an alias to its canonical name.  The name
        server handles CNAME records in a different manner than aliases
        are handled in the host table.  When a name server looks up a name
        and finds a CNAME record, it replaces the name with the canonical
	name and looks up the new name.

So, to clarify that:

You generally want to use a CNAME to simplify addressing.  Suppose you
have a host on your network that acts as a www, ftp and mail server on
x.x.x.2.  This machine is probably a central part of your company's
network, so you may decide on a hostname of ringmaster.  Reverse lookups
from this host will return x.x.x.2, and ringmaster.domain.  You don't want
to force all your mail, ftp and www clients to remember to connect to
ringmaster, and, you may decide to move some of those services to other
machines later.  So, CNAMES come in to play:

ringmaster	IN	A	x.x.x.2
www		IN	CNAME	ringmaster
mail		IN	CNAME	ringmaster
ftp		IN	CNAME	ringmaster

Then, when lookups are done, BOTH names will be returned (i.e., the alias,
and the canonical name).  So, nslookup ftp would return something like
this:

Server:  localhost
Address: 0.0.0.0

Name:    ringmaster.some.host
Address: x.x.x.2
Aliases: www.some.host

> A records should be used as an alias for a host but co-exists with
> other hosts.

> www	IN	A	(IP address)
> foo	IN	A	(same IP as www)
> bar	IN	CNAME	(some other IP or hostname)
> etc	IN	A	(bar's hostname)
> 
> So in this case, bar should be the only one out of the four that has a
> reverse entry?

No.  That almost sounds backwards.   If you have the following:

www x.x.x.1
foo x.x.x.1  (same machine as www)
bar x.x.x.2
etc x.x.x.2  (same machine as bar)

use:

www	IN	A	x.x.x.1
foo	IN	CNAME	www
bar	IN	A	x.x.x.2
etc	IN	CNAME	bar

That way, if bar's IP address changes, for example, you don't have to
modify the record for etc.  That may not seem like much of a savings, but
consider what we do for our domain clients:

They may run n number of services on their machines (ftp, www, mail,
whatever)... But we obviously don't allow them to have their own news
feed.  So, they're stuck connecting to our news server. (news.isp.host).
Now, why should they have to remember to connect to news.isp.host
(x.x.x.5) , when they could be using news.their.domain?  They could use an
A entry:

news.their.domain.	IN	A	x.x.x.5

But, if the IP of our news server changed, ALL of our news customers would
have an invalid address in their zone files!

So, this is where CNAMES become really handy:

news.their.domain.	IN	CNAME	news.isp.host.

Then, even if news.isp.host. moves halfway around the world, NO ONE has to
adjust their zone files.

-- 
  Ryan Thompson <ryan@sasknow.com>
  Systems Administrator, Accounts
  Phone: +1 (306) 664-1161

  SaskNow Technologies     http://www.sasknow.com
  #106-380 3120 8th St E   Saskatoon, SK  S7H 0W2



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0003121408340.6666-100000>