* Re: [gentoo-user] /etc/hosts include file?
@ 2013-03-08 13:40 99% ` Michael Mol
0 siblings, 0 replies; 1+ results
From: Michael Mol @ 2013-03-08 13:40 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 3605 bytes --]
On 03/08/2013 03:32 AM, Alan McKinnon wrote:
> On 08/03/2013 02:29, Michael Mol wrote:
>> On 03/07/2013 05:24 PM, Alan McKinnon wrote:
>>> Anyone know if there's a way to get /etc/hosts to support the notion of
>>> an include file? I did my homework and found nothing, maybe someone else
>>> knows more.
>>>
>>> I really do need this, I have an app that discovers things on the
>>> network and knows their address. This makes it's automated way into DNS
>>> but takes a few days, and another app needs to use the fqdn right now.
>>> So /etc/hosts is the way to go for the interim three days.
>>>
>>> I've worked around it by creating /etc/hosts.d/ containing a header and
>>> a data file. cat the two and redirect to /etc/hosts.d/hosts and the real
>>> hosts file is a symlink to that. It's a sub-directory as none of these
>>> apps run as root and only root can modiy the real hosts file.
>>>
>>> This works well enough, but a supported include mechanism would make
>>> life so much simpler, not to mention easier for my colleagues to
>>> understand what the blazes I set up :-)
>>
>> No, there's not an "include" directive.
>>
>> There are, however, two other ways to get hostnames recognized.
>>
>> The first is /etc/resolv.conf . You can point your host at a local DNS
>> server which is aware of the discovered hosts, and which forwards the
>> rest of the queries. (This is how Samba 4's internal DNS server
>> operates; anything it knows, it responds to. Everything else, it forwards.)
>>
>> Read the manpage for resolv.conf...there's a lot of stuff in there
>> you'll want to know as you start coping with IPv6. (And some useful
>> stuff if you want to favor a particular IP range...)
>
> And the day started off so well. Then you had to come along and mention
> IPv6.... :-)
>
> IPv6 is wonderfully easy to use client-side and reasonably easy to plug
> into an existing network (the routers mostly know what to do already).
> The fun starts when you need to write an app that tracks and does range
> allocations at ISP scale, all while keeping the PTRs in line too. Sadly
> for me, my team works in that area and such a magic app is one of our
> deliverables
My mouth is watering...
>
> One day when I've climbed down off the walls and my fingernails have
> grown back, I might be up to relating what it is taking to get that
> done.... :-)
I don't suppose you knew I'm a huge IPv6 advocate, and travel around my
state giving free training sessions...
I would absolutely love to hear about the problems you're facing.
Further, I'd love to help you get past them...and can put you in touch
with experts who might also be able to help.
>
>>
>> The second is /etc/nsswitch.conf . nsswitch.conf is how you inject
>> samba-discovered, NIS-offered -- or whatever provider you care to inject
>> -- hostname databases into the system resolver. You could have it query
>> your provided database first, moving on to other sources if your
>> provided database doesn't have what you're looking for. (I'm actually
>> kinda surprised avahi doesn't come with an nss plugin...)
>
> One day I should read nsswitch's man page completely. I never needed to
> know more than "dns files" for the hosts directives and that shadow does
> user. All those other lookup schemes are things I never use.
I've never mucked with NIS, but I muck with samba from time to time.
If you're already in a developer context, I'd suggest writing an NSS
plugin the system resolver can check on. That's the angle I'd take in
your circumstance.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 555 bytes --]
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-03-07 22:24 [gentoo-user] /etc/hosts include file? Alan McKinnon
2013-03-08 0:29 ` Michael Mol
2013-03-08 8:32 ` Alan McKinnon
2013-03-08 13:40 99% ` Michael Mol
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox