help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealing with multiple domains


From: Chris Edillon
Subject: Re: dealing with multiple domains
Date: Mon, 10 Feb 2003 23:23:09 -0400 (GMT+4)

On Mon, 10 Feb 2003, Nate Campi wrote:

> On Mon, Feb 10, 2003 at 10:54:37PM -0400, Chris Edillon wrote:
> > 
> > #!/bin/sh
> > # getdomain
> > PATH=/bin
> > echo `grep ^domain /etc/resolv.conf | awk '{print $2}'`
> > 
> > you might want to make the script more robust by checking for a
> > search directive as well (assuming the proper domain is the first
> > one listed in the search list), and returning "undefined.domain"
> > if you can't figure it out from /etc/resolv.conf.
> 
> It's not robust to use resolv.conf in this way at all. I don't use
> "domain" directives in that file on any of my hosts, since the "search"
> directive conflicts the "domain" directive (and I use the "search"
> directive).
> 
  i've found in practice that they can coexist in resolv.conf,
and that the search directive overrides the domain directive.
because of this, one could concievably have both and use the
domain directive for nothing other than information purposes,
such as for a cfengine script.  :)

>  <URL:http://marc.theaimsgroup.com/?l=bind-users&m=104380458118448&w=2>
> 
> You might be able to rely on "domain" being in resolv.conf on each of
> your hosts, though, so this could work at your site. Just be aware that
> it's no guaranteed to work on all hosts.
> 
  oh, i agree with you.  since the DNS is independent of any
host or group of hosts, the only really robust way of determining
a machine's domain (if a machine can be said to have one) is to
look up the PTR record for the host's IP address.  and that only
tells you the authoritative DNS answer, which might be independent
of what the host itself thinks (from resolv.conf, /etc/hosts, the
hostname itself) and doesn't take into account other A records or
CNAME records....  for luke's purposes, though if he knows what is
in all of his resolv.conf files this should suffice.
  other than the fact that the domain seems to be required for remote
copies in cfengine 2, i've never found the domain useful.  at the
customer site where i use cfengine heavily (1.6.x), we had control of
multiple DNS domains and wanted to order the search path specifically
for each host dependend upon physical location (which didn't correspond
to the various domains), so i always used editfile: to maintain
/etc/resolv.conf anyway.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]