[Gllug] CNAME in a BIND9 Zone File

Ian Northeast ian at house-from-hell.demon.co.uk
Fri Sep 12 19:08:27 UTC 2003


Chris Bell wrote:
> 
> On Thu 11 Sep, Xander D Harkness wrote:
> >
> > Chris Bell wrote:
> >
> > >Hello,
> > >   I am trying to correct a reported error in a zone file for the domain
> > >"localdomain". There are no reported errors amongst the NS, MX, and A
> > >records, but if I want to refer to a machine by just its name, and enter a
> > >corresponding CNAME record to supply the fully qualified domain name, that
> > >line is ignored as out-of-zone data. I have tried various configurations
> > >without success, and am not sure whether it is a problem of location or
> > >contents of the line. All the CNAME records are at the end of the file.
> > >   A typical line showing the single word alias and FQDN appears at the end
> > >of /etc/bind/db.localdomain
> > >
> > >hotdogs.  IN  CNAME  hotdogs.localdomain.
> > >
> > >   Any help much appreciated, thanks.
> > >
> > >
> > Are you sure you should not be looking looking at the search option in
> > the resolv.conf.  When your machine searches for hotdogs it will try
> > hotdogs.searchdomain.com hotdogs.searchdomain2.com then hotdogs.
> >
> > I think your nameserver sees that it has no authority for hotdogs and
> > goes straight to root servers.
> >
> > if you turn on querylog (rndc querylog) and watch the messeges log on
> > your nameserver you will see the queries as they come in.
> >
> > Kind regards
> > Xander
> >
> 
>    Thanks for the reply. The first line of /etc/resolv.conf is
> 
> search localdomain
> 
> but the problem shows as the configuration file /etc/bind/db.localdomain is
> read on booting, with a report in syslog that any similar line is ignored.
> The alias "hotdogs" is followed by a "." in the CNAME reference to prevent
> the domain name from being added, which would convert the alias into the
> FQDN. The rest of the zone file is accepted and used normally.

Chris, what you are trying to do is invalid. "hotdogs." is not in domain
"localdomain." so bind is rejecting it. You cannot put that record
there.

Does the search directive in /etc/resolv.conf not do what you want? This
will make the system resolver try "hotdogs.localdomain" when you say
just "hotdogs" (I assume there is a name "hotdogs" - no terminating "."
- in localdomain is there? If not that may be the problem.)

Note that bind utilities like dig and host don't use the system resolver
and will not do this.

If you really need to create a name "hotdogs." you have to create a
domain of that name at put an A record at the origin. A CNAME is not
legal here, as if a label has a CNAME it may have no other data and the
domain origin must have an SOA and NS records so it cannot also have a
CNAME.

I do this occasionally e.g. to get mail headers written by internal
machines to contain names unqualified by our private internal DNS name
but it's rather unusual and not generally required.

If this doesn't help then please let us know exactly what you are trying
to achieve here.

Regards, Ian

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list