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

Re: Re making routes permanent



On Mon, Apr 28, 2003 at 08:46:28PM +0200, linuxinfo@linuxpro.co.za wrote:
> i currently have 2 route add -net statments in my inittab file..

inittab is the wrong place for route statements.

> Where is the corret place to save route setting.
> 
> I have a number of routes that need to be permanent and must survive a
> system resart.

unless you want to use a routing daemon like zebra (which is overkill for this
job),  look at the man page for interfaces(5), the "up" command is probably
what you want.

e.g. something like this in /etc/network/interfaces:

iface eth0 inet static
  address x.x.x.x
  netmask 255.255.255.0
  broadcast x.x.x.255
  up route add -net y.y.y.y gw z.z.z.z
  up route add -net a.a.a.a gw z.z.z.z


alternatively, create a new script in /etc/init.d (and make sure it runs at the
appropriate time during the desired run-levels with update-rc.d) or just make a
simple script in /etc/rc.boot



that works for static interfaces like ethernet cards.  for dynamic interfaces
(i.e. that are likely to go up and down between reboots) you need to make sure
that the routes are re-established when the interface goes up.

if the routes go via a ppp (or pppoe) interface, then you need to add routing
commands to a script in /etc/ppp/ip-up.d

if the routes are via a tunnel then set the routes in the configuration of whatever
tunneling software you are using (e.g. /etc/vtund.conf for vtun).

craig



Reply to: