Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2014 00:09:37 -0700
From:      perryh@pluto.rain.com (Perry Hutchison)
To:        sclists@gmail.com, erichsfreebsdlist@alogt.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: "hosts" file for jails (ezjail)
Message-ID:  <53fae131.SSzyZWb9H/N2EkA3%perryh@pluto.rain.com>
In-Reply-To: <20140825114658.1ebfaa1c@X220.alogt.com>
References:  <53FA92E1.7000300@gmail.com> <20140825114658.1ebfaa1c@X220.alogt.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Erich Dollansky <erichsfreebsdlist@alogt.com> wrote:
> On Sun, 24 Aug 2014 21:35:29 -0400
> Stephen Cook <sclists@gmail.com> wrote:
> > Is there a way to get a bunch of jails (I'm using ezjail) to share
> > the same hosts file, preferably one stored somewhere on the host OS?
> > ...
> > I'd like to be able to update the file when I add a new jail, and
> > have the others able to connect to it by whatever stupid name I give
> > it, without editing all those different hosts files. But I suspect
> > the whole point of jails being kept separate from the host filesystem
> > might be in my way.
>
> what you want is against the idea of jails.

Indeed.  OTOH one of the longstanding strengths of Unix -- and
the motivation for "mechanism, not policy" -- is that mechanisms
can often be cleverly used in ways that their designers did not
anticipate.

> What you can do, creates in the root filesystem the hosts file
> and write a script which copies it then into the jails.

That (and variants, such as using puppet to maintain the jails'
configuration files) is likely the most general approach.

In the particular case where all of the jails are contained
within the same host filesystem, it should also be possible
to use hardlinks (so that all the jails share the same inode).
Granted this would enable any jail to overwrite what the others
see -- which may or may not be acceptable in the OP's situation.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53fae131.SSzyZWb9H/N2EkA3%perryh>