[ale] is there a bash command to include a file in /etc/hosts?

Wolf Halton wolf.halton at gmail.com
Thu Jul 12 14:14:21 EDT 2012


On Thu, Jul 12, 2012 at 9:31 AM, Lightner, Jeff <JLightner at water.com> wrote:

>   Interesting – I see 2 responses to this thread but don’t see the
> original question email.****
>
> ** **
>
> If I read the title and what appears to be the original question he is
> asking not how to source /etc/hosts but rather how to have /etc/hosts
> source another file.    I don’t believe there is a way to do this.  ****
>
> ** **
>
> I’m also curious as to the reason for the question.   If you’re trying to
> use something global for hosts definitions to be shared for multiple
> clients you should look at a DNS or NIS setup.   /etc/hosts is meant to be
> local to the system you’re on.****
>
> ** **
>
> *From:* ale-bounces at ale.org [mailto:ale-bounces at ale.org] *On Behalf Of *Jim
> Kinney
> *Sent:* Thursday, July 12, 2012 9:13 AM
> *To:* Atlanta Linux Enthusiasts
> *Subject:* Re: [ale] is there a bash command to include a file in
> /etc/hosts?****
>
> ** **
>
> +1****
>
> On Jul 12, 2012 8:45 AM, "leam hall" <leamhall at gmail.com> wrote:****
>
> Wolf,****
>
> ** **
>
> You can sometimes source a file in bash with the ".". That is:****
>
> ** **
>
>   .    /etc/hosts****
>
> ** **
>
> Note the spaces there. However, I believe that will fail as sourcing is
> used when files are executed. The hosts file is read on reference by
> programs that need it. If you are trying to keep things separated by
> breaking up files, have you considered using "make" to rebuild your host
> file if any of the component files changes?****
>
> ** **
>
> Leam****
>
> ** **
>
> On Thu, Jul 12, 2012 at 7:26 AM, Wolf Halton <wolf.halton at gmail.com>
> wrote:****
>
> I have tried
> source /path/to/file
> and
> include(/path/to/file)
> without success.
>
> Wolf
>
> --
> This Apt Has Super Cow Powers - http://sourcefreedom.com
> Open-Source Software in Libraries - http://FOSS4Lib.org
> Advancing Libraries Together - http://LYRASIS.org
> Apache Open Office Developer wolfhalton at apache.org
>
>
>
>
>
>
>   _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo****
>
>
>
> ****
>
> ** **
>
> -- ****
>
> Mind on a Mission <http://leamhall.blogspot.com/>****
>
> ** **
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo****
>
>
>
>
>
> Athena®, Created for the Cause™
>
> Making a Difference in the Fight Against Breast Cancer
>
>
>
>
>
> *How and Why I Should Support Bottled Water!
> *Do not relinquish your right to choose bottled water as a healthy
> alternative to beverages that contain sugar, calories, etc. Your support of
> bottled water will make a difference! Your signatures count! Go to
> http://www.bottledwatermatters.org/luv-bottledwater-iframe/dswaters and
> sign a petition to support your right to always choose bottled water. Help
> fight federal and state issues, such as bottle deposits (or taxes) and
> organizations that want to ban the sale of bottled water. Support community
> curbside recycling programs. Support bottled water as a healthy way to
> maintain proper hydration. Our goal is 50,000 signatures. Share this
> petition with your friends and family today!
>
>
>
> ---------------------------------
> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential
> information and is for the sole use of the intended recipient(s). If you
> are not the intended recipient, any disclosure, copying, distribution, or
> use of the contents of this information is prohibited and may be unlawful.
> If you have received this electronic transmission in error, please reply
> immediately to the sender that you have received the message in error, and
> delete it. Thank you.
> ----------------------------------****
>
>
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
Exactly.
I want to use a variation on DNS that lets me name my internal machines the
same names as their FQDN so that the machines work with each other exactly
how they work with hosts outside my private network.  One of the rules the
firewall admins require is that one host in the private range may not send
packets out through the firewall that will eventually loop back through the
firewall to another host on the internal network.
Yes, I can just add a host to the /etc/hosts file that has "192.168.0.23
wolfhalton.info" as the recipient's IP mapping, but I wanted to have a file
I could drop into any of my local machines with the local info, so if I
want to make changes in the internal networking, I can just change the file
and distribute it where it is needed.  Keeps the hosts file uncluttered.  I
can also map IPs to non-authentic FQDNs like cat.fish, dog.fish and so on
with this scheme, if I want to.  I cannot distribute the names to my
nameservers so nobody external will be able to find http://cat.fish.
The other option that might work is to modify the resolv system so it looks
for hosts and hosts2 before looking for a DNS service.
I don't want to start making IPTables rules or adding to hosts.allow and
hosts.deny.

-- 
This Apt Has Super Cow Powers - http://sourcefreedom.com
Open-Source Software in Libraries - http://FOSS4Lib.org
Advancing Libraries Together - http://LYRASIS.org
Apache Open Office Developer wolfhalton at apache.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20120712/b69e46fa/attachment-0001.html 


More information about the Ale mailing list