Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] /etc/hosts include file?
Date: Fri, 08 Mar 2013 15:39:20
In Reply to: Re: [gentoo-user] /etc/hosts include file? by Michael Mol
1 Am 08.03.2013 01:29, schrieb Michael Mol:
2 > On 03/07/2013 05:24 PM, Alan McKinnon wrote:
3 >> Anyone know if there's a way to get /etc/hosts to support the notion of
4 >> an include file? I did my homework and found nothing, maybe someone else
5 >> knows more.
6 >>
7 >> I really do need this, I have an app that discovers things on the
8 >> network and knows their address. This makes it's automated way into DNS
9 >> but takes a few days, and another app needs to use the fqdn right now.
10 >> So /etc/hosts is the way to go for the interim three days.
11 >>
12 >> I've worked around it by creating /etc/hosts.d/ containing a header and
13 >> a data file. cat the two and redirect to /etc/hosts.d/hosts and the real
14 >> hosts file is a symlink to that. It's a sub-directory as none of these
15 >> apps run as root and only root can modiy the real hosts file.
16 >>
17 >> This works well enough, but a supported include mechanism would make
18 >> life so much simpler, not to mention easier for my colleagues to
19 >> understand what the blazes I set up :-)
20 >
21 > No, there's not an "include" directive.
22 >
23 > There are, however, two other ways to get hostnames recognized.
24 >
25 > The first is /etc/resolv.conf . You can point your host at a local DNS
26 > server which is aware of the discovered hosts, and which forwards the
27 > rest of the queries. (This is how Samba 4's internal DNS server
28 > operates; anything it knows, it responds to. Everything else, it forwards.)
29 >
31 dnsmasq also works like this and is probably easier to set up. FWIW it
32 also supports include files.
34 Regards,
35 Florian Philipp


File name MIME type
signature.asc application/pgp-signature