[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: network configuration

On Tue, Feb 02, 1999 at 08:06:56AM -0600, Richard Kaszeta wrote:
> Samuel Tardieu writes ("Re: network configuration"):
> >| IMHO no end user should fiddle around with /etc/rc*. Why is there no
> >| /etc/network.conf or similar.
> >
> >An "end user" will not change the configuration himself, the system
> >administrator will, and I think he can fiddle with this file.
> Well, the issue I have is that I tend to move machines around my
> network alot (since I tend to 'clone' exisiting machines instead of
> raw installs), and changing the network identity of a machine is
> unneccesarily complicated, since I need to change:
> 1. /etc/hostname to change the host name
> 2. /etc/hosts to add the host name
> 3. /etc/networks to change the network
> 4. /etc/init.d/network to change one line for each of the net
>    settings, even though most of this data is redundant.

it's trivial to write a script to change these automatically. i did this
when i was "mass-producing" ppp dialin servers for schools a few years
ago. just write 'template' versions of the config files that need to
be changed, and then a perl or bash and ed and sed script to make the
changes. once it's written, it takes about a minute to run the script to
customise each box.

use replaceable tokens like ___IPADDRESS___, ___NETWORK___,
___HOSTNAME___, etc in the template versions of the config files to give
ed or sed or perl something easy to search and replace.

perl is probably best. 'perl -i' is good for editing a file without
going through intermediary temp files. ed is also good for this but a
bit harder to write scripts for (not as intuitively obvious, but simple
once you figure it out).

the hardest part is PLANNING what needs to be changed, the scripting
is easy once you know what needs to be done....and it looks like you
already know most of that, with your 4 steps listed above.


craig sanders

Reply to: