1 |
On 08/03/2013 02:29, Michael Mol wrote: |
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 |
> |
30 |
> Read the manpage for resolv.conf...there's a lot of stuff in there |
31 |
> you'll want to know as you start coping with IPv6. (And some useful |
32 |
> stuff if you want to favor a particular IP range...) |
33 |
|
34 |
And the day started off so well. Then you had to come along and mention |
35 |
IPv6.... :-) |
36 |
|
37 |
IPv6 is wonderfully easy to use client-side and reasonably easy to plug |
38 |
into an existing network (the routers mostly know what to do already). |
39 |
The fun starts when you need to write an app that tracks and does range |
40 |
allocations at ISP scale, all while keeping the PTRs in line too. Sadly |
41 |
for me, my team works in that area and such a magic app is one of our |
42 |
deliverables |
43 |
|
44 |
One day when I've climbed down off the walls and my fingernails have |
45 |
grown back, I might be up to relating what it is taking to get that |
46 |
done.... :-) |
47 |
|
48 |
> |
49 |
> The second is /etc/nsswitch.conf . nsswitch.conf is how you inject |
50 |
> samba-discovered, NIS-offered -- or whatever provider you care to inject |
51 |
> -- hostname databases into the system resolver. You could have it query |
52 |
> your provided database first, moving on to other sources if your |
53 |
> provided database doesn't have what you're looking for. (I'm actually |
54 |
> kinda surprised avahi doesn't come with an nss plugin...) |
55 |
|
56 |
One day I should read nsswitch's man page completely. I never needed to |
57 |
know more than "dns files" for the hosts directives and that shadow does |
58 |
user. All those other lookup schemes are things I never use. |
59 |
|
60 |
|
61 |
|
62 |
|
63 |
-- |
64 |
Alan McKinnon |
65 |
alan.mckinnon@×××××.com |