Re: /etc/init.d/network is too simple?
On Fri, 16 Apr 1999, Steve Lamb wrote:
> From: Steve Lamb <morpheus@rpglink.com>
> Subject: Re: /etc/init.d/network is too simple?
> X-Mailer: PMMail 98 Professional (2.01.1600) For Windows NT (4.0.1381;3)
>
> -----BEGIN PGP SIGNED MESSAGE-----
>
> On Fri, 16 Apr 1999 18:23:02 +0200 (CEST), Piotr Roszatycki wrote:
>
> >The idea is to use bash functions, for example:
>
> And if bash isn't installed?
Shell functions present in all POSIX-compatible shell.
Of course, there could be more elegant ideas such as use arrays
to store IPs, netmasks etc for various inteface.
As far as I know, bash was last of all Bourne-compatible shells to acquire
arrays (not counting such special-purpose things as ash and sash)
Reallty there should be separate files, perhaps in /etc/network
which consist solely of variable definitions:
say:
/etc/network/eth1
IPADDR=192.168.217.1
NETMASK=255.255.255.0
NETWORK=
BROADCAST=
and base script should contain something like
echo -n "configuring network interfaces "
for i in /etc/network/*; do
interface=`basename $i`
source $i
echo "$interface "
ifconfig $interface $IPADDR netmask $NETMASK
route add -net ${NETWORK}
done
echo ""
Possibly, there should be separtate script to configure network interfaces
say /sbin/netconfig
and /etc/init.d/network
should contain only
case $1 of
start)
for $i in `ls /etc/network` ; do
/sbin/netconfig $i up
done
;;
stop)
for $i in `ls /etc/network` ; do
/sbin/netconfig $i down
done
;;
esac
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
Reply to: