Static Routes?

Gerard Beekmans gerard at
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
> files.
> Any ideas?
> ie: if I want to add let's say
> route add -net netmask eth1
> route add -net netmask eth1
> route add -net netmask eth2
> route add -net netmask eth0
> .....
> etc
> ....

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

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.

Gerard Beekmans

-*- If Linux doesn't have the solution, you have the wrong problem -*-
Unsubscribe: send email to listar at
and put 'unsubscribe lfs-support' in the subject header of the message

More information about the lfs-support mailing list