gerard at linuxfromscratch.org
Mon Mar 25 09:15:58 PST 2002
On Sun, Mar 24, 2002 at 11:57:57AM -0500, Eric wrote:
> Am I missing something? I've already gone thru the bootscripts
> (rc.d/init.d/network), and basically, it looks for a config file where
> ONBOOT is set to yes, and if so, then extracts the IP address, and Netmask
> from it. But if you have multiple static routes that must be set, then I
> would need to create a separate config file for each route. But then the
> problem is that init.d/network calls ifup using the extension of
> ifconfig.eth0 as its argument. So I can't create multiple ifconfig.eth0
> Any ideas?
> ie: if I want to add let's say
> route add -net 192.168.1.15 netmask 255.255.255.255 eth1
> route add -net 18.104.22.168 netmask 255.255.0.0 eth1
> route add -net 192.168.5.0 netmask 255.255.255.0 eth2
> route add -net 192.168.0.0 netmask 255.255.0.0 eth0
There is no clean way, but you can hack your way around it. You may
actually find this to be semi-clean...
Create a file /etc/sysconfig/network-devices/ifconfig.staticroutes and put
ONBOOT=YES in it (as the only line).
Normally the network script invokes the network-devices/ifup script which
will look for a few variables in the ifconfig.staticroutes file like IP
NETMASK and BROADCAST.
However, if you create the /etc/sysconfig/network-devices/ifup-devicename
file where devicename is the same as from ifconfig.devicename, 'ifup' will
execute that script rather than running a default ifconfig command.
This script (/etc/sysconfig/network-devices/ifup-staticroutes) will in your
case contain a few 'route' commands to setup the above routes.
Likewise you can create the ifdown-staticroutes to remove the routes later.
-*- If Linux doesn't have the solution, you have the wrong problem -*-
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message
More information about the lfs-support