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

Chuck Payne terrorpup at gmail.com
Fri Jul 13 10:27:24 EDT 2012


On Fri, Jul 13, 2012 at 9:28 AM, Derek Atkins <warlord at mit.edu> wrote:
> "Barlow, Jim D" <jim.d.barlow at intel.com> writes:
>
>> Wolf Halton wrote:
>>
>>> 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.
>>
>> Here is another option:    puppet
>>
>> Puppet is in the EPEL repository.   I use it to maintain the /etc/hosts file on anything below the localhost lines.    It does a nice job of adding / deleting / changing your file.
>
> Why not just use DNS views?
>
> Have an "internal DNS" that is only served to your internal hosts, and
> then have an "external DNS" that is shown to everyone else?  The
> internal view would have your internal addresses, whereas the external
> view would only have the external addresses.
>
>> 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
>
> -derek
>
> --
>        Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>        Member, MIT Student Information Processing Board  (SIPB)
>        URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
>        warlord at MIT.EDU                        PGP key available
>
> _______________________________________________
> 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

Wolf,

So that I better understand what you are doing. You want wanting to
use the entries in /etc/hosts instead of use setup or adding host to
DNS. If that correct, I think the problem might be your nsswitch.conf,
yes I am going a bit old school, but I bet the line in the file is set
to this

hosts: dns files

Change it to

hosts: files dns

Usually that file is set to

hosts: db files nisplus nis dns

You can do a split view dns, but that only useful if you are doing for
the whole office.  Here a sample of my bind conf file

view "internal" {
#options for this view
     match-clients  {
                      key ns1.smeghead.com;
                      key ns2.smeghead.com;
                      "localnet";
     };
     server 192.168.105.3 {
             keys { ns1.smegheadcom; };
     };
     server 192.168.105.2 {
             keys {  ns2.smeghead.com; };
     };
     recursion yes;

             zone "." {
                     type hint;
                     file "shared/named.root";
             };
             zone "localhost" {
                     type master;
                     file "shared/localhost-forward.db";
             };
             zone  "magidesign.com" {
                     type master;
                     file "internal/smeghead.com.zone";

 allow-transfer { "slaves"; };
             };
             zone  "0.0.127.in-addr.arpa" {
                      type master;
                      file "shared/localhost-reverse.db";
             };
};

view  "external" {
       # options for this view
       match-clients  {
                      key ns1.smeghead.com.;
                      key ns2.smeghead.com.;
                      "localnet";
       };
       server 192.168.1.3 {
             keys { ns1.smeghead.com; };
       };
       server 192.168.1.2 {
             keys {  ns2.smeghead.com; };
       };
       recursion no;

            zone "smeghead.com" {
                   type slave;
                   file "external/smeghead.com";
                   masters { 192.168.1.3; };
            };

};


I hope that helps.


-- 
Terror PUP a.k.a
Chuck "PUP" Payne

(678) 636-9678
-----------------------------------------
Discover it! Enjoy it! Share it! openSUSE Linux.
-----------------------------------------
openSUSE -- en.opensuse.org/User:Terrorpup
openSUSE Ambassador/openSUSE Member
Community Manager -- Southeast Linux Foundation (SELF)
skype,twiiter,identica,friendfeed -- terrorpup
freenode(irc) --terrorpup/lupinstein
Register Linux Userid: 155363

Have you tried SUSE Studio? Need to create a Live CD,  an app you want
to package and distribute , or create your own linux distro. Give SUSE
Studio a try. www.susestudio.com.
See you at Southeast Linux Fest, June 8-10, 2012 in Charlotte, NC.
www.southeastlinuxfest.org



More information about the Ale mailing list